Square Connect API
POST
RegisterDomain
{{baseUrl}}/v2/apple-pay/domains
BODY json
{
"domain_name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/apple-pay/domains");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"domain_name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/apple-pay/domains" {:content-type :json
:form-params {:domain_name ""}})
require "http/client"
url = "{{baseUrl}}/v2/apple-pay/domains"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"domain_name\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/apple-pay/domains"),
Content = new StringContent("{\n \"domain_name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/apple-pay/domains");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"domain_name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/apple-pay/domains"
payload := strings.NewReader("{\n \"domain_name\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/apple-pay/domains HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 23
{
"domain_name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/apple-pay/domains")
.setHeader("content-type", "application/json")
.setBody("{\n \"domain_name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/apple-pay/domains"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"domain_name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"domain_name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/apple-pay/domains")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/apple-pay/domains")
.header("content-type", "application/json")
.body("{\n \"domain_name\": \"\"\n}")
.asString();
const data = JSON.stringify({
domain_name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/apple-pay/domains');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/apple-pay/domains',
headers: {'content-type': 'application/json'},
data: {domain_name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/apple-pay/domains';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"domain_name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/apple-pay/domains',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "domain_name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"domain_name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/apple-pay/domains")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/apple-pay/domains',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({domain_name: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/apple-pay/domains',
headers: {'content-type': 'application/json'},
body: {domain_name: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/apple-pay/domains');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
domain_name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/apple-pay/domains',
headers: {'content-type': 'application/json'},
data: {domain_name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/apple-pay/domains';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"domain_name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"domain_name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/apple-pay/domains"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/apple-pay/domains" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"domain_name\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/apple-pay/domains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'domain_name' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/apple-pay/domains', [
'body' => '{
"domain_name": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/apple-pay/domains');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'domain_name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'domain_name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/apple-pay/domains');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/apple-pay/domains' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"domain_name": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/apple-pay/domains' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"domain_name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"domain_name\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/apple-pay/domains", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/apple-pay/domains"
payload = { "domain_name": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/apple-pay/domains"
payload <- "{\n \"domain_name\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/apple-pay/domains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"domain_name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/apple-pay/domains') do |req|
req.body = "{\n \"domain_name\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/apple-pay/domains";
let payload = json!({"domain_name": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/apple-pay/domains \
--header 'content-type: application/json' \
--data '{
"domain_name": ""
}'
echo '{
"domain_name": ""
}' | \
http POST {{baseUrl}}/v2/apple-pay/domains \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "domain_name": ""\n}' \
--output-document \
- {{baseUrl}}/v2/apple-pay/domains
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["domain_name": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/apple-pay/domains")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"status": "VERIFIED"
}
GET
GetBankAccount
{{baseUrl}}/v2/bank-accounts/:bank_account_id
QUERY PARAMS
bank_account_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bank-accounts/:bank_account_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/bank-accounts/:bank_account_id")
require "http/client"
url = "{{baseUrl}}/v2/bank-accounts/:bank_account_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/bank-accounts/:bank_account_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bank-accounts/:bank_account_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bank-accounts/:bank_account_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/bank-accounts/:bank_account_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/bank-accounts/:bank_account_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bank-accounts/:bank_account_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bank-accounts/:bank_account_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/bank-accounts/:bank_account_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/bank-accounts/:bank_account_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bank-accounts/:bank_account_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bank-accounts/:bank_account_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bank-accounts/:bank_account_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/bank-accounts/:bank_account_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bank-accounts/:bank_account_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bank-accounts/:bank_account_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/bank-accounts/:bank_account_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bank-accounts/:bank_account_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bank-accounts/:bank_account_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bank-accounts/:bank_account_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bank-accounts/:bank_account_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bank-accounts/:bank_account_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/bank-accounts/:bank_account_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bank-accounts/:bank_account_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/bank-accounts/:bank_account_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bank-accounts/:bank_account_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bank-accounts/:bank_account_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/bank-accounts/:bank_account_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bank-accounts/:bank_account_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bank-accounts/:bank_account_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bank-accounts/:bank_account_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/bank-accounts/:bank_account_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bank-accounts/:bank_account_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/bank-accounts/:bank_account_id
http GET {{baseUrl}}/v2/bank-accounts/:bank_account_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/bank-accounts/:bank_account_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bank-accounts/:bank_account_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"bank_account": {
"account_number_suffix": "971",
"account_type": "CHECKING",
"bank_name": "Bank Name",
"country": "US",
"creditable": false,
"currency": "USD",
"debitable": false,
"holder_name": "Jane Doe",
"id": "w3yRgCGYQnwmdl0R3GB",
"location_id": "S8GWD5example",
"primary_bank_identification_number": "112200303",
"status": "VERIFICATION_IN_PROGRESS",
"version": 5
}
}
GET
GetBankAccountByV1Id
{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id
QUERY PARAMS
v1_bank_account_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id")
require "http/client"
url = "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/bank-accounts/by-v1-id/:v1_bank_account_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bank-accounts/by-v1-id/:v1_bank_account_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/bank-accounts/by-v1-id/:v1_bank_account_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/bank-accounts/by-v1-id/:v1_bank_account_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id
http GET {{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bank-accounts/by-v1-id/:v1_bank_account_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"bank_account": {
"account_number_suffix": "971",
"account_type": "CHECKING",
"bank_name": "Bank Name",
"country": "US",
"creditable": false,
"currency": "USD",
"debitable": false,
"holder_name": "Jane Doe",
"id": "w3yRgCGYQnwmdl0R3GB",
"location_id": "S8GWD5example",
"primary_bank_identification_number": "112200303",
"status": "VERIFICATION_IN_PROGRESS",
"version": 5
}
}
GET
ListBankAccounts
{{baseUrl}}/v2/bank-accounts
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bank-accounts");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/bank-accounts")
require "http/client"
url = "{{baseUrl}}/v2/bank-accounts"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/bank-accounts"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bank-accounts");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bank-accounts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/bank-accounts HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/bank-accounts")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bank-accounts"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bank-accounts")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/bank-accounts")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/bank-accounts');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/bank-accounts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bank-accounts';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bank-accounts',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/bank-accounts")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bank-accounts',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/bank-accounts'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/bank-accounts');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/bank-accounts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bank-accounts';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bank-accounts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bank-accounts" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bank-accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/bank-accounts');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bank-accounts');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/bank-accounts');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bank-accounts' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bank-accounts' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/bank-accounts")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bank-accounts"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bank-accounts"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bank-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/bank-accounts') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bank-accounts";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/bank-accounts
http GET {{baseUrl}}/v2/bank-accounts
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/bank-accounts
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bank-accounts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"bank_accounts": [
{
"account_number_suffix": "971",
"account_type": "CHECKING",
"bank_name": "Bank Name",
"country": "US",
"creditable": false,
"currency": "USD",
"debitable": false,
"holder_name": "Jane Doe",
"id": "ao6iaQ9vhDiaQD7n3GB",
"location_id": "S8GWD5example",
"primary_bank_identification_number": "112200303",
"status": "VERIFICATION_IN_PROGRESS",
"version": 5
},
{
"account_number_suffix": "972",
"account_type": "CHECKING",
"bank_name": "Bank Name",
"country": "US",
"creditable": false,
"currency": "USD",
"debitable": false,
"holder_name": "Jane Doe",
"id": "4x7WXuaxrkQkVlka3GB",
"location_id": "S8GWD5example",
"primary_bank_identification_number": "112200303",
"status": "VERIFICATION_IN_PROGRESS",
"version": 5
}
]
}
POST
CancelBooking
{{baseUrl}}/v2/bookings/:booking_id/cancel
QUERY PARAMS
booking_id
BODY json
{
"booking_version": 0,
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bookings/:booking_id/cancel");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/bookings/:booking_id/cancel" {:content-type :json
:form-params {:booking_version 0
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/bookings/:booking_id/cancel"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/bookings/:booking_id/cancel"),
Content = new StringContent("{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bookings/:booking_id/cancel");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bookings/:booking_id/cancel"
payload := strings.NewReader("{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/bookings/:booking_id/cancel HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 51
{
"booking_version": 0,
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/bookings/:booking_id/cancel")
.setHeader("content-type", "application/json")
.setBody("{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bookings/:booking_id/cancel"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bookings/:booking_id/cancel")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/bookings/:booking_id/cancel")
.header("content-type", "application/json")
.body("{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
booking_version: 0,
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/bookings/:booking_id/cancel');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings/:booking_id/cancel',
headers: {'content-type': 'application/json'},
data: {booking_version: 0, idempotency_key: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bookings/:booking_id/cancel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"booking_version":0,"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bookings/:booking_id/cancel',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "booking_version": 0,\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/bookings/:booking_id/cancel")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bookings/:booking_id/cancel',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({booking_version: 0, idempotency_key: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings/:booking_id/cancel',
headers: {'content-type': 'application/json'},
body: {booking_version: 0, idempotency_key: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/bookings/:booking_id/cancel');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
booking_version: 0,
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings/:booking_id/cancel',
headers: {'content-type': 'application/json'},
data: {booking_version: 0, idempotency_key: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bookings/:booking_id/cancel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"booking_version":0,"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"booking_version": @0,
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bookings/:booking_id/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bookings/:booking_id/cancel" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bookings/:booking_id/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'booking_version' => 0,
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/bookings/:booking_id/cancel', [
'body' => '{
"booking_version": 0,
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bookings/:booking_id/cancel');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'booking_version' => 0,
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'booking_version' => 0,
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/bookings/:booking_id/cancel');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bookings/:booking_id/cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"booking_version": 0,
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bookings/:booking_id/cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"booking_version": 0,
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/bookings/:booking_id/cancel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bookings/:booking_id/cancel"
payload = {
"booking_version": 0,
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bookings/:booking_id/cancel"
payload <- "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bookings/:booking_id/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/bookings/:booking_id/cancel') do |req|
req.body = "{\n \"booking_version\": 0,\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bookings/:booking_id/cancel";
let payload = json!({
"booking_version": 0,
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/bookings/:booking_id/cancel \
--header 'content-type: application/json' \
--data '{
"booking_version": 0,
"idempotency_key": ""
}'
echo '{
"booking_version": 0,
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/bookings/:booking_id/cancel \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "booking_version": 0,\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/bookings/:booking_id/cancel
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"booking_version": 0,
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bookings/:booking_id/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"booking": {
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"created_at": "2020-10-28T15:47:41Z",
"customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M",
"customer_note": "",
"id": "zkras0xv0xwswx",
"location_id": "LEQHH0YY8B42M",
"seller_note": "",
"start_at": "2020-11-26T13:00:00Z",
"status": "CANCELLED_BY_CUSTOMER",
"updated_at": "2020-10-28T15:49:25Z",
"version": 1
},
"errors": []
}
POST
CreateBooking
{{baseUrl}}/v2/bookings
BODY json
{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bookings");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/bookings" {:content-type :json
:form-params {:booking {:appointment_segments [{:duration_minutes 0
:service_variation_id ""
:service_variation_version 0
:team_member_id ""}]
:created_at ""
:customer_id ""
:customer_note ""
:id ""
:location_id ""
:seller_note ""
:start_at ""
:status ""
:updated_at ""
:version 0}
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/bookings"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/bookings"),
Content = new StringContent("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bookings");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bookings"
payload := strings.NewReader("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/bookings HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 443
{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/bookings")
.setHeader("content-type", "application/json")
.setBody("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bookings"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bookings")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/bookings")
.header("content-type", "application/json")
.body("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/bookings');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings',
headers: {'content-type': 'application/json'},
data: {
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bookings';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"booking":{"appointment_segments":[{"duration_minutes":0,"service_variation_id":"","service_variation_version":0,"team_member_id":""}],"created_at":"","customer_id":"","customer_note":"","id":"","location_id":"","seller_note":"","start_at":"","status":"","updated_at":"","version":0},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bookings',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "booking": {\n "appointment_segments": [\n {\n "duration_minutes": 0,\n "service_variation_id": "",\n "service_variation_version": 0,\n "team_member_id": ""\n }\n ],\n "created_at": "",\n "customer_id": "",\n "customer_note": "",\n "id": "",\n "location_id": "",\n "seller_note": "",\n "start_at": "",\n "status": "",\n "updated_at": "",\n "version": 0\n },\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/bookings")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bookings',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings',
headers: {'content-type': 'application/json'},
body: {
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/bookings');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings',
headers: {'content-type': 'application/json'},
data: {
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bookings';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"booking":{"appointment_segments":[{"duration_minutes":0,"service_variation_id":"","service_variation_version":0,"team_member_id":""}],"created_at":"","customer_id":"","customer_note":"","id":"","location_id":"","seller_note":"","start_at":"","status":"","updated_at":"","version":0},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"booking": @{ @"appointment_segments": @[ @{ @"duration_minutes": @0, @"service_variation_id": @"", @"service_variation_version": @0, @"team_member_id": @"" } ], @"created_at": @"", @"customer_id": @"", @"customer_note": @"", @"id": @"", @"location_id": @"", @"seller_note": @"", @"start_at": @"", @"status": @"", @"updated_at": @"", @"version": @0 },
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bookings"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bookings" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bookings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'booking' => [
'appointment_segments' => [
[
'duration_minutes' => 0,
'service_variation_id' => '',
'service_variation_version' => 0,
'team_member_id' => ''
]
],
'created_at' => '',
'customer_id' => '',
'customer_note' => '',
'id' => '',
'location_id' => '',
'seller_note' => '',
'start_at' => '',
'status' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/bookings', [
'body' => '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bookings');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'booking' => [
'appointment_segments' => [
[
'duration_minutes' => 0,
'service_variation_id' => '',
'service_variation_version' => 0,
'team_member_id' => ''
]
],
'created_at' => '',
'customer_id' => '',
'customer_note' => '',
'id' => '',
'location_id' => '',
'seller_note' => '',
'start_at' => '',
'status' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'booking' => [
'appointment_segments' => [
[
'duration_minutes' => 0,
'service_variation_id' => '',
'service_variation_version' => 0,
'team_member_id' => ''
]
],
'created_at' => '',
'customer_id' => '',
'customer_note' => '',
'id' => '',
'location_id' => '',
'seller_note' => '',
'start_at' => '',
'status' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/bookings');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bookings' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bookings' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/bookings", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bookings"
payload = {
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bookings"
payload <- "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bookings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/bookings') do |req|
req.body = "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bookings";
let payload = json!({
"booking": json!({
"appointment_segments": (
json!({
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
})
),
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
}),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/bookings \
--header 'content-type: application/json' \
--data '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
echo '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/bookings \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "booking": {\n "appointment_segments": [\n {\n "duration_minutes": 0,\n "service_variation_id": "",\n "service_variation_version": 0,\n "team_member_id": ""\n }\n ],\n "created_at": "",\n "customer_id": "",\n "customer_note": "",\n "id": "",\n "location_id": "",\n "seller_note": "",\n "start_at": "",\n "status": "",\n "updated_at": "",\n "version": 0\n },\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/bookings
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"booking": [
"appointment_segments": [
[
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
]
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bookings")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"booking": {
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"created_at": "2020-10-28T15:47:41Z",
"customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M",
"customer_note": "",
"id": "zkras0xv0xwswx",
"location_id": "LEQHH0YY8B42M",
"seller_note": "",
"start_at": "2020-11-26T13:00:00Z",
"status": "ACCEPTED",
"updated_at": "2020-10-28T15:47:41Z",
"version": 0
},
"errors": []
}
GET
ListTeamMemberBookingProfiles
{{baseUrl}}/v2/bookings/team-member-booking-profiles
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bookings/team-member-booking-profiles");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/bookings/team-member-booking-profiles")
require "http/client"
url = "{{baseUrl}}/v2/bookings/team-member-booking-profiles"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/bookings/team-member-booking-profiles"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bookings/team-member-booking-profiles");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bookings/team-member-booking-profiles"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/bookings/team-member-booking-profiles HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/bookings/team-member-booking-profiles")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bookings/team-member-booking-profiles"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bookings/team-member-booking-profiles")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/bookings/team-member-booking-profiles")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/bookings/team-member-booking-profiles');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/team-member-booking-profiles'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bookings/team-member-booking-profiles';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bookings/team-member-booking-profiles',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/bookings/team-member-booking-profiles")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bookings/team-member-booking-profiles',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/team-member-booking-profiles'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/bookings/team-member-booking-profiles');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/team-member-booking-profiles'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bookings/team-member-booking-profiles';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bookings/team-member-booking-profiles"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bookings/team-member-booking-profiles" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bookings/team-member-booking-profiles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/bookings/team-member-booking-profiles');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bookings/team-member-booking-profiles');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/bookings/team-member-booking-profiles');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bookings/team-member-booking-profiles' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bookings/team-member-booking-profiles' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/bookings/team-member-booking-profiles")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bookings/team-member-booking-profiles"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bookings/team-member-booking-profiles"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bookings/team-member-booking-profiles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/bookings/team-member-booking-profiles') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bookings/team-member-booking-profiles";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/bookings/team-member-booking-profiles
http GET {{baseUrl}}/v2/bookings/team-member-booking-profiles
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/bookings/team-member-booking-profiles
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bookings/team-member-booking-profiles")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [],
"team_member_booking_profiles": [
{
"display_name": "Sandbox Seller",
"is_bookable": true,
"team_member_id": "TMXUrsBWWcHTt79t"
},
{
"display_name": "Sandbox Staff",
"is_bookable": true,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
]
}
GET
RetrieveBooking
{{baseUrl}}/v2/bookings/:booking_id
QUERY PARAMS
booking_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bookings/:booking_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/bookings/:booking_id")
require "http/client"
url = "{{baseUrl}}/v2/bookings/:booking_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/bookings/:booking_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bookings/:booking_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bookings/:booking_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/bookings/:booking_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/bookings/:booking_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bookings/:booking_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bookings/:booking_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/bookings/:booking_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/bookings/:booking_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/bookings/:booking_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bookings/:booking_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bookings/:booking_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/bookings/:booking_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bookings/:booking_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/bookings/:booking_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/bookings/:booking_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/bookings/:booking_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bookings/:booking_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bookings/:booking_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bookings/:booking_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bookings/:booking_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/bookings/:booking_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bookings/:booking_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/bookings/:booking_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bookings/:booking_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bookings/:booking_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/bookings/:booking_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bookings/:booking_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bookings/:booking_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bookings/:booking_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/bookings/:booking_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bookings/:booking_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/bookings/:booking_id
http GET {{baseUrl}}/v2/bookings/:booking_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/bookings/:booking_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bookings/:booking_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"booking": {
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"created_at": "2020-10-28T15:47:41Z",
"customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M",
"customer_note": "",
"id": "zkras0xv0xwswx",
"location_id": "LEQHH0YY8B42M",
"seller_note": "",
"start_at": "2020-11-26T13:00:00Z",
"status": "ACCEPTED",
"updated_at": "2020-10-28T15:49:25Z",
"version": 1
},
"errors": []
}
GET
RetrieveBusinessBookingProfile
{{baseUrl}}/v2/bookings/business-booking-profile
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bookings/business-booking-profile");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/bookings/business-booking-profile")
require "http/client"
url = "{{baseUrl}}/v2/bookings/business-booking-profile"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/bookings/business-booking-profile"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bookings/business-booking-profile");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bookings/business-booking-profile"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/bookings/business-booking-profile HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/bookings/business-booking-profile")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bookings/business-booking-profile"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bookings/business-booking-profile")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/bookings/business-booking-profile")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/bookings/business-booking-profile');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/business-booking-profile'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bookings/business-booking-profile';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bookings/business-booking-profile',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/bookings/business-booking-profile")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bookings/business-booking-profile',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/business-booking-profile'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/bookings/business-booking-profile');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/business-booking-profile'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bookings/business-booking-profile';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bookings/business-booking-profile"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bookings/business-booking-profile" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bookings/business-booking-profile",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/bookings/business-booking-profile');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bookings/business-booking-profile');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/bookings/business-booking-profile');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bookings/business-booking-profile' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bookings/business-booking-profile' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/bookings/business-booking-profile")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bookings/business-booking-profile"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bookings/business-booking-profile"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bookings/business-booking-profile")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/bookings/business-booking-profile') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bookings/business-booking-profile";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/bookings/business-booking-profile
http GET {{baseUrl}}/v2/bookings/business-booking-profile
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/bookings/business-booking-profile
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bookings/business-booking-profile")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"business_booking_profile": {
"allow_user_cancel": true,
"booking_enabled": true,
"booking_policy": "ACCEPT_ALL",
"business_appointment_settings": {
"alignment_time": "HALF_HOURLY",
"any_team_member_booking_enabled": true,
"cancellation_fee_money": {
"currency": "USD"
},
"cancellation_policy": "CUSTOM_POLICY",
"location_types": [
"BUSINESS_LOCATION"
],
"max_booking_lead_time_seconds": 31536000,
"min_booking_lead_time_seconds": 0,
"multiple_service_booking_enabled": true,
"skip_booking_flow_staff_selection": false
},
"created_at": "2020-09-10T21:40:38Z",
"customer_timezone_choice": "CUSTOMER_CHOICE",
"seller_id": "MLJQYZZRM0D3Y"
},
"errors": []
}
GET
RetrieveTeamMemberBookingProfile
{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id
QUERY PARAMS
team_member_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id")
require "http/client"
url = "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/bookings/team-member-booking-profiles/:team_member_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bookings/team-member-booking-profiles/:team_member_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/bookings/team-member-booking-profiles/:team_member_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/bookings/team-member-booking-profiles/:team_member_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id
http GET {{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bookings/team-member-booking-profiles/:team_member_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [],
"team_member_booking_profile": {
"display_name": "Sandbox Staff",
"is_bookable": true,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
}
POST
SearchAvailability
{{baseUrl}}/v2/bookings/availability/search
BODY json
{
"query": {
"filter": {
"booking_id": "",
"location_id": "",
"segment_filters": [
{
"service_variation_id": "",
"team_member_id_filter": {
"all": [],
"any": [],
"none": []
}
}
],
"start_at_range": {
"end_at": "",
"start_at": ""
}
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bookings/availability/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/bookings/availability/search" {:content-type :json
:form-params {:query {:filter {:booking_id ""
:location_id ""
:segment_filters [{:service_variation_id ""
:team_member_id_filter {:all []
:any []
:none []}}]
:start_at_range {:end_at ""
:start_at ""}}}}})
require "http/client"
url = "{{baseUrl}}/v2/bookings/availability/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/bookings/availability/search"),
Content = new StringContent("{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bookings/availability/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bookings/availability/search"
payload := strings.NewReader("{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/bookings/availability/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 382
{
"query": {
"filter": {
"booking_id": "",
"location_id": "",
"segment_filters": [
{
"service_variation_id": "",
"team_member_id_filter": {
"all": [],
"any": [],
"none": []
}
}
],
"start_at_range": {
"end_at": "",
"start_at": ""
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/bookings/availability/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bookings/availability/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bookings/availability/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/bookings/availability/search")
.header("content-type", "application/json")
.body("{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}")
.asString();
const data = JSON.stringify({
query: {
filter: {
booking_id: '',
location_id: '',
segment_filters: [
{
service_variation_id: '',
team_member_id_filter: {
all: [],
any: [],
none: []
}
}
],
start_at_range: {
end_at: '',
start_at: ''
}
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/bookings/availability/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings/availability/search',
headers: {'content-type': 'application/json'},
data: {
query: {
filter: {
booking_id: '',
location_id: '',
segment_filters: [
{service_variation_id: '', team_member_id_filter: {all: [], any: [], none: []}}
],
start_at_range: {end_at: '', start_at: ''}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bookings/availability/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"query":{"filter":{"booking_id":"","location_id":"","segment_filters":[{"service_variation_id":"","team_member_id_filter":{"all":[],"any":[],"none":[]}}],"start_at_range":{"end_at":"","start_at":""}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bookings/availability/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "query": {\n "filter": {\n "booking_id": "",\n "location_id": "",\n "segment_filters": [\n {\n "service_variation_id": "",\n "team_member_id_filter": {\n "all": [],\n "any": [],\n "none": []\n }\n }\n ],\n "start_at_range": {\n "end_at": "",\n "start_at": ""\n }\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/bookings/availability/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bookings/availability/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
query: {
filter: {
booking_id: '',
location_id: '',
segment_filters: [
{service_variation_id: '', team_member_id_filter: {all: [], any: [], none: []}}
],
start_at_range: {end_at: '', start_at: ''}
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings/availability/search',
headers: {'content-type': 'application/json'},
body: {
query: {
filter: {
booking_id: '',
location_id: '',
segment_filters: [
{service_variation_id: '', team_member_id_filter: {all: [], any: [], none: []}}
],
start_at_range: {end_at: '', start_at: ''}
}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/bookings/availability/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
query: {
filter: {
booking_id: '',
location_id: '',
segment_filters: [
{
service_variation_id: '',
team_member_id_filter: {
all: [],
any: [],
none: []
}
}
],
start_at_range: {
end_at: '',
start_at: ''
}
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/bookings/availability/search',
headers: {'content-type': 'application/json'},
data: {
query: {
filter: {
booking_id: '',
location_id: '',
segment_filters: [
{service_variation_id: '', team_member_id_filter: {all: [], any: [], none: []}}
],
start_at_range: {end_at: '', start_at: ''}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bookings/availability/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"query":{"filter":{"booking_id":"","location_id":"","segment_filters":[{"service_variation_id":"","team_member_id_filter":{"all":[],"any":[],"none":[]}}],"start_at_range":{"end_at":"","start_at":""}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"query": @{ @"filter": @{ @"booking_id": @"", @"location_id": @"", @"segment_filters": @[ @{ @"service_variation_id": @"", @"team_member_id_filter": @{ @"all": @[ ], @"any": @[ ], @"none": @[ ] } } ], @"start_at_range": @{ @"end_at": @"", @"start_at": @"" } } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bookings/availability/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bookings/availability/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bookings/availability/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => [
'filter' => [
'booking_id' => '',
'location_id' => '',
'segment_filters' => [
[
'service_variation_id' => '',
'team_member_id_filter' => [
'all' => [
],
'any' => [
],
'none' => [
]
]
]
],
'start_at_range' => [
'end_at' => '',
'start_at' => ''
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/bookings/availability/search', [
'body' => '{
"query": {
"filter": {
"booking_id": "",
"location_id": "",
"segment_filters": [
{
"service_variation_id": "",
"team_member_id_filter": {
"all": [],
"any": [],
"none": []
}
}
],
"start_at_range": {
"end_at": "",
"start_at": ""
}
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bookings/availability/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'query' => [
'filter' => [
'booking_id' => '',
'location_id' => '',
'segment_filters' => [
[
'service_variation_id' => '',
'team_member_id_filter' => [
'all' => [
],
'any' => [
],
'none' => [
]
]
]
],
'start_at_range' => [
'end_at' => '',
'start_at' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'query' => [
'filter' => [
'booking_id' => '',
'location_id' => '',
'segment_filters' => [
[
'service_variation_id' => '',
'team_member_id_filter' => [
'all' => [
],
'any' => [
],
'none' => [
]
]
]
],
'start_at_range' => [
'end_at' => '',
'start_at' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/bookings/availability/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bookings/availability/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": {
"filter": {
"booking_id": "",
"location_id": "",
"segment_filters": [
{
"service_variation_id": "",
"team_member_id_filter": {
"all": [],
"any": [],
"none": []
}
}
],
"start_at_range": {
"end_at": "",
"start_at": ""
}
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bookings/availability/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": {
"filter": {
"booking_id": "",
"location_id": "",
"segment_filters": [
{
"service_variation_id": "",
"team_member_id_filter": {
"all": [],
"any": [],
"none": []
}
}
],
"start_at_range": {
"end_at": "",
"start_at": ""
}
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/bookings/availability/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bookings/availability/search"
payload = { "query": { "filter": {
"booking_id": "",
"location_id": "",
"segment_filters": [
{
"service_variation_id": "",
"team_member_id_filter": {
"all": [],
"any": [],
"none": []
}
}
],
"start_at_range": {
"end_at": "",
"start_at": ""
}
} } }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bookings/availability/search"
payload <- "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bookings/availability/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/bookings/availability/search') do |req|
req.body = "{\n \"query\": {\n \"filter\": {\n \"booking_id\": \"\",\n \"location_id\": \"\",\n \"segment_filters\": [\n {\n \"service_variation_id\": \"\",\n \"team_member_id_filter\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n }\n }\n ],\n \"start_at_range\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bookings/availability/search";
let payload = json!({"query": json!({"filter": json!({
"booking_id": "",
"location_id": "",
"segment_filters": (
json!({
"service_variation_id": "",
"team_member_id_filter": json!({
"all": (),
"any": (),
"none": ()
})
})
),
"start_at_range": json!({
"end_at": "",
"start_at": ""
})
})})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/bookings/availability/search \
--header 'content-type: application/json' \
--data '{
"query": {
"filter": {
"booking_id": "",
"location_id": "",
"segment_filters": [
{
"service_variation_id": "",
"team_member_id_filter": {
"all": [],
"any": [],
"none": []
}
}
],
"start_at_range": {
"end_at": "",
"start_at": ""
}
}
}
}'
echo '{
"query": {
"filter": {
"booking_id": "",
"location_id": "",
"segment_filters": [
{
"service_variation_id": "",
"team_member_id_filter": {
"all": [],
"any": [],
"none": []
}
}
],
"start_at_range": {
"end_at": "",
"start_at": ""
}
}
}
}' | \
http POST {{baseUrl}}/v2/bookings/availability/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "query": {\n "filter": {\n "booking_id": "",\n "location_id": "",\n "segment_filters": [\n {\n "service_variation_id": "",\n "team_member_id_filter": {\n "all": [],\n "any": [],\n "none": []\n }\n }\n ],\n "start_at_range": {\n "end_at": "",\n "start_at": ""\n }\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/bookings/availability/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["query": ["filter": [
"booking_id": "",
"location_id": "",
"segment_filters": [
[
"service_variation_id": "",
"team_member_id_filter": [
"all": [],
"any": [],
"none": []
]
]
],
"start_at_range": [
"end_at": "",
"start_at": ""
]
]]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bookings/availability/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"availabilities": [
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-26T13:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-26T13:30:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-26T14:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-26T14:30:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-26T15:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-26T15:30:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-26T16:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T09:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T09:30:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T10:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T10:30:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T11:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T11:30:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T12:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T12:30:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T13:00:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T13:30:00Z"
},
{
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMaJcbiRqPIGZuS9"
}
],
"location_id": "LEQHH0YY8B42M",
"start_at": "2020-11-27T14:00:00Z"
}
],
"errors": []
}
PUT
UpdateBooking
{{baseUrl}}/v2/bookings/:booking_id
QUERY PARAMS
booking_id
BODY json
{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/bookings/:booking_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/bookings/:booking_id" {:content-type :json
:form-params {:booking {:appointment_segments [{:duration_minutes 0
:service_variation_id ""
:service_variation_version 0
:team_member_id ""}]
:created_at ""
:customer_id ""
:customer_note ""
:id ""
:location_id ""
:seller_note ""
:start_at ""
:status ""
:updated_at ""
:version 0}
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/bookings/:booking_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/bookings/:booking_id"),
Content = new StringContent("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/bookings/:booking_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/bookings/:booking_id"
payload := strings.NewReader("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/bookings/:booking_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 443
{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/bookings/:booking_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/bookings/:booking_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/bookings/:booking_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/bookings/:booking_id")
.header("content-type", "application/json")
.body("{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/bookings/:booking_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/bookings/:booking_id',
headers: {'content-type': 'application/json'},
data: {
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/bookings/:booking_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"booking":{"appointment_segments":[{"duration_minutes":0,"service_variation_id":"","service_variation_version":0,"team_member_id":""}],"created_at":"","customer_id":"","customer_note":"","id":"","location_id":"","seller_note":"","start_at":"","status":"","updated_at":"","version":0},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/bookings/:booking_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "booking": {\n "appointment_segments": [\n {\n "duration_minutes": 0,\n "service_variation_id": "",\n "service_variation_version": 0,\n "team_member_id": ""\n }\n ],\n "created_at": "",\n "customer_id": "",\n "customer_note": "",\n "id": "",\n "location_id": "",\n "seller_note": "",\n "start_at": "",\n "status": "",\n "updated_at": "",\n "version": 0\n },\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/bookings/:booking_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/bookings/:booking_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/bookings/:booking_id',
headers: {'content-type': 'application/json'},
body: {
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/bookings/:booking_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/bookings/:booking_id',
headers: {'content-type': 'application/json'},
data: {
booking: {
appointment_segments: [
{
duration_minutes: 0,
service_variation_id: '',
service_variation_version: 0,
team_member_id: ''
}
],
created_at: '',
customer_id: '',
customer_note: '',
id: '',
location_id: '',
seller_note: '',
start_at: '',
status: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/bookings/:booking_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"booking":{"appointment_segments":[{"duration_minutes":0,"service_variation_id":"","service_variation_version":0,"team_member_id":""}],"created_at":"","customer_id":"","customer_note":"","id":"","location_id":"","seller_note":"","start_at":"","status":"","updated_at":"","version":0},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"booking": @{ @"appointment_segments": @[ @{ @"duration_minutes": @0, @"service_variation_id": @"", @"service_variation_version": @0, @"team_member_id": @"" } ], @"created_at": @"", @"customer_id": @"", @"customer_note": @"", @"id": @"", @"location_id": @"", @"seller_note": @"", @"start_at": @"", @"status": @"", @"updated_at": @"", @"version": @0 },
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/bookings/:booking_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/bookings/:booking_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/bookings/:booking_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'booking' => [
'appointment_segments' => [
[
'duration_minutes' => 0,
'service_variation_id' => '',
'service_variation_version' => 0,
'team_member_id' => ''
]
],
'created_at' => '',
'customer_id' => '',
'customer_note' => '',
'id' => '',
'location_id' => '',
'seller_note' => '',
'start_at' => '',
'status' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/bookings/:booking_id', [
'body' => '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/bookings/:booking_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'booking' => [
'appointment_segments' => [
[
'duration_minutes' => 0,
'service_variation_id' => '',
'service_variation_version' => 0,
'team_member_id' => ''
]
],
'created_at' => '',
'customer_id' => '',
'customer_note' => '',
'id' => '',
'location_id' => '',
'seller_note' => '',
'start_at' => '',
'status' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'booking' => [
'appointment_segments' => [
[
'duration_minutes' => 0,
'service_variation_id' => '',
'service_variation_version' => 0,
'team_member_id' => ''
]
],
'created_at' => '',
'customer_id' => '',
'customer_note' => '',
'id' => '',
'location_id' => '',
'seller_note' => '',
'start_at' => '',
'status' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/bookings/:booking_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/bookings/:booking_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/bookings/:booking_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/bookings/:booking_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/bookings/:booking_id"
payload = {
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/bookings/:booking_id"
payload <- "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/bookings/:booking_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/bookings/:booking_id') do |req|
req.body = "{\n \"booking\": {\n \"appointment_segments\": [\n {\n \"duration_minutes\": 0,\n \"service_variation_id\": \"\",\n \"service_variation_version\": 0,\n \"team_member_id\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"customer_note\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"seller_note\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/bookings/:booking_id";
let payload = json!({
"booking": json!({
"appointment_segments": (
json!({
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
})
),
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
}),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/bookings/:booking_id \
--header 'content-type: application/json' \
--data '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
echo '{
"booking": {
"appointment_segments": [
{
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
}
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}' | \
http PUT {{baseUrl}}/v2/bookings/:booking_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "booking": {\n "appointment_segments": [\n {\n "duration_minutes": 0,\n "service_variation_id": "",\n "service_variation_version": 0,\n "team_member_id": ""\n }\n ],\n "created_at": "",\n "customer_id": "",\n "customer_note": "",\n "id": "",\n "location_id": "",\n "seller_note": "",\n "start_at": "",\n "status": "",\n "updated_at": "",\n "version": 0\n },\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/bookings/:booking_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"booking": [
"appointment_segments": [
[
"duration_minutes": 0,
"service_variation_id": "",
"service_variation_version": 0,
"team_member_id": ""
]
],
"created_at": "",
"customer_id": "",
"customer_note": "",
"id": "",
"location_id": "",
"seller_note": "",
"start_at": "",
"status": "",
"updated_at": "",
"version": 0
],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/bookings/:booking_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"booking": {
"appointment_segments": [
{
"duration_minutes": 60,
"service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC",
"service_variation_version": 1599775456731,
"team_member_id": "TMXUrsBWWcHTt79t"
}
],
"created_at": "2020-10-28T15:47:41Z",
"customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M",
"customer_note": "I would like to sit near the window please",
"id": "zkras0xv0xwswx",
"location_id": "LEQHH0YY8B42M",
"seller_note": "",
"start_at": "2020-11-26T13:00:00Z",
"status": "ACCEPTED",
"updated_at": "2020-10-28T15:49:25Z",
"version": 2
},
"errors": []
}
POST
CreateCard
{{baseUrl}}/v2/cards
BODY json
{
"card": {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"idempotency_key": "",
"source_id": "",
"verification_token": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/cards");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/cards" {:content-type :json
:form-params {:card {:billing_address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:bin ""
:card_brand ""
:card_type ""
:cardholder_name ""
:customer_id ""
:enabled false
:exp_month 0
:exp_year 0
:fingerprint ""
:id ""
:last_4 ""
:prepaid_type ""
:reference_id ""
:version 0}
:idempotency_key ""
:source_id ""
:verification_token ""}})
require "http/client"
url = "{{baseUrl}}/v2/cards"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/cards"),
Content = new StringContent("{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/cards");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/cards"
payload := strings.NewReader("{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/cards HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 850
{
"card": {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"idempotency_key": "",
"source_id": "",
"verification_token": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/cards")
.setHeader("content-type", "application/json")
.setBody("{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/cards"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/cards")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/cards")
.header("content-type", "application/json")
.body("{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}")
.asString();
const data = JSON.stringify({
card: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
idempotency_key: '',
source_id: '',
verification_token: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/cards');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/cards',
headers: {'content-type': 'application/json'},
data: {
card: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
idempotency_key: '',
source_id: '',
verification_token: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/cards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"card":{"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"idempotency_key":"","source_id":"","verification_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/cards',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "card": {\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "idempotency_key": "",\n "source_id": "",\n "verification_token": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/cards")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/cards',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
card: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
idempotency_key: '',
source_id: '',
verification_token: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/cards',
headers: {'content-type': 'application/json'},
body: {
card: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
idempotency_key: '',
source_id: '',
verification_token: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/cards');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
card: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
idempotency_key: '',
source_id: '',
verification_token: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/cards',
headers: {'content-type': 'application/json'},
data: {
card: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
idempotency_key: '',
source_id: '',
verification_token: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/cards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"card":{"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"idempotency_key":"","source_id":"","verification_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"card": @{ @"billing_address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"bin": @"", @"card_brand": @"", @"card_type": @"", @"cardholder_name": @"", @"customer_id": @"", @"enabled": @NO, @"exp_month": @0, @"exp_year": @0, @"fingerprint": @"", @"id": @"", @"last_4": @"", @"prepaid_type": @"", @"reference_id": @"", @"version": @0 },
@"idempotency_key": @"",
@"source_id": @"",
@"verification_token": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/cards"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/cards" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/cards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'card' => [
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'idempotency_key' => '',
'source_id' => '',
'verification_token' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/cards', [
'body' => '{
"card": {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"idempotency_key": "",
"source_id": "",
"verification_token": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/cards');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'card' => [
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'idempotency_key' => '',
'source_id' => '',
'verification_token' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'card' => [
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'idempotency_key' => '',
'source_id' => '',
'verification_token' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/cards');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/cards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"card": {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"idempotency_key": "",
"source_id": "",
"verification_token": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/cards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"card": {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"idempotency_key": "",
"source_id": "",
"verification_token": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/cards", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/cards"
payload = {
"card": {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": False,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"idempotency_key": "",
"source_id": "",
"verification_token": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/cards"
payload <- "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/cards') do |req|
req.body = "{\n \"card\": {\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\",\n \"source_id\": \"\",\n \"verification_token\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/cards";
let payload = json!({
"card": json!({
"billing_address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
}),
"idempotency_key": "",
"source_id": "",
"verification_token": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/cards \
--header 'content-type: application/json' \
--data '{
"card": {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"idempotency_key": "",
"source_id": "",
"verification_token": ""
}'
echo '{
"card": {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"idempotency_key": "",
"source_id": "",
"verification_token": ""
}' | \
http POST {{baseUrl}}/v2/cards \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "card": {\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "idempotency_key": "",\n "source_id": "",\n "verification_token": ""\n}' \
--output-document \
- {{baseUrl}}/v2/cards
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"card": [
"billing_address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
],
"idempotency_key": "",
"source_id": "",
"verification_token": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/cards")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"card": {
"billing_address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"bin": "411111",
"card_brand": "VISA",
"card_type": "CREDIT",
"cardholder_name": "Amelia Earhart",
"customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
"enabled": true,
"exp_month": 11,
"exp_year": 2022,
"fingerprint": "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q",
"id": "ccof:uIbfJXhXETSP197M3GB",
"last_4": "1111",
"prepaid_type": "NOT_PREPAID",
"reference_id": "user-id-1",
"version": 1
}
}
POST
DisableCard
{{baseUrl}}/v2/cards/:card_id/disable
QUERY PARAMS
card_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/cards/:card_id/disable");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/cards/:card_id/disable")
require "http/client"
url = "{{baseUrl}}/v2/cards/:card_id/disable"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/cards/:card_id/disable"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/cards/:card_id/disable");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/cards/:card_id/disable"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/cards/:card_id/disable HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/cards/:card_id/disable")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/cards/:card_id/disable"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/cards/:card_id/disable")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/cards/:card_id/disable")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/cards/:card_id/disable');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/v2/cards/:card_id/disable'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/cards/:card_id/disable';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/cards/:card_id/disable',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/cards/:card_id/disable")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/cards/:card_id/disable',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'POST', url: '{{baseUrl}}/v2/cards/:card_id/disable'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/cards/:card_id/disable');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'POST', url: '{{baseUrl}}/v2/cards/:card_id/disable'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/cards/:card_id/disable';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/cards/:card_id/disable"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/cards/:card_id/disable" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/cards/:card_id/disable",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/cards/:card_id/disable');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/cards/:card_id/disable');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/cards/:card_id/disable');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/cards/:card_id/disable' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/cards/:card_id/disable' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/cards/:card_id/disable")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/cards/:card_id/disable"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/cards/:card_id/disable"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/cards/:card_id/disable")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/cards/:card_id/disable') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/cards/:card_id/disable";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/cards/:card_id/disable
http POST {{baseUrl}}/v2/cards/:card_id/disable
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/cards/:card_id/disable
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/cards/:card_id/disable")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"card": {
"billing_address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"bin": "411111",
"card_brand": "VISA",
"card_type": "CREDIT",
"cardholder_name": "Amelia Earhart",
"customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
"enabled": false,
"exp_month": 11,
"exp_year": 2022,
"fingerprint": "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q",
"id": "ccof:uIbfJXhXETSP197M3GB",
"last_4": "1111",
"prepaid_type": "NOT_PREPAID",
"reference_id": "user-id-1",
"version": 2
}
}
GET
ListCards
{{baseUrl}}/v2/cards
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/cards");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/cards")
require "http/client"
url = "{{baseUrl}}/v2/cards"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/cards"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/cards");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/cards"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/cards HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/cards")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/cards"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/cards")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/cards")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/cards');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/cards'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/cards';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/cards',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/cards")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/cards',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/cards'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/cards');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/cards'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/cards';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/cards"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/cards" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/cards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/cards');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/cards');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/cards');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/cards' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/cards' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/cards")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/cards"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/cards"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/cards') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/cards";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/cards
http GET {{baseUrl}}/v2/cards
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/cards
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/cards")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cards": [
{
"card": {
"billing_address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"bin": "411111",
"card_brand": "VISA",
"card_type": "CREDIT",
"cardholder_name": "Amelia Earhart",
"customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
"enabled": true,
"exp_month": 11,
"exp_year": 2022,
"fingerprint": "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q",
"id": "ccof:uIbfJXhXETSP197M3GB",
"last_4": "1111",
"prepaid_type": "NOT_PREPAID",
"reference_id": "user-id-1",
"version": 1
}
}
]
}
GET
RetrieveCard
{{baseUrl}}/v2/cards/:card_id
QUERY PARAMS
card_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/cards/:card_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/cards/:card_id")
require "http/client"
url = "{{baseUrl}}/v2/cards/:card_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/cards/:card_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/cards/:card_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/cards/:card_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/cards/:card_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/cards/:card_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/cards/:card_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/cards/:card_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/cards/:card_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/cards/:card_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/cards/:card_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/cards/:card_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/cards/:card_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/cards/:card_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/cards/:card_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/cards/:card_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/cards/:card_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/cards/:card_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/cards/:card_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/cards/:card_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/cards/:card_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/cards/:card_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/cards/:card_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/cards/:card_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/cards/:card_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/cards/:card_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/cards/:card_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/cards/:card_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/cards/:card_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/cards/:card_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/cards/:card_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/cards/:card_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/cards/:card_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/cards/:card_id
http GET {{baseUrl}}/v2/cards/:card_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/cards/:card_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/cards/:card_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"card": {
"billing_address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"bin": "411111",
"card_brand": "VISA",
"card_type": "CREDIT",
"cardholder_name": "Amelia Earhart",
"customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8",
"enabled": true,
"exp_month": 11,
"exp_year": 2022,
"fingerprint": "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q",
"id": "ccof:uIbfJXhXETSP197M3GB",
"last_4": "1111",
"prepaid_type": "NOT_PREPAID",
"reference_id": "user-id-1",
"version": 1
}
}
GET
ListCashDrawerShiftEvents
{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events
QUERY PARAMS
location_id
shift_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events" {:query-params {:location_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id="
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/cash-drawers/shifts/:shift_id/events?location_id= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id="))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events',
params: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/cash-drawers/shifts/:shift_id/events?location_id=',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events',
qs: {location_id: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events');
req.query({
location_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events',
params: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'location_id' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'location_id' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/cash-drawers/shifts/:shift_id/events?location_id=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events"
querystring = {"location_id":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events"
queryString <- list(location_id = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/cash-drawers/shifts/:shift_id/events') do |req|
req.params['location_id'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events";
let querystring = [
("location_id", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id='
http GET '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id/events?location_id=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"events": [
{
"created_at": "2019-11-22T00:43:02.000Z",
"description": "",
"event_money": {
"amount": 100,
"currency": "USD"
},
"event_type": "CASH_TENDER_PAYMENT",
"id": "9F07DB01-D85A-4B77-88C3-D5C64CEB5155"
},
{
"created_at": "2019-11-22T00:43:12.000Z",
"description": "",
"event_money": {
"amount": 250,
"currency": "USD"
},
"event_type": "CASH_TENDER_PAYMENT",
"id": "B2854CEA-A781-49B3-8F31-C64558231F48"
},
{
"created_at": "2019-11-22T00:43:23.000Z",
"description": "",
"event_money": {
"amount": 250,
"currency": "USD"
},
"event_type": "CASH_TENDER_CANCELLED_PAYMENT",
"id": "B5FB7F72-95CD-44A3-974D-26C41064D042"
},
{
"created_at": "2019-11-22T00:43:46.000Z",
"description": "",
"event_money": {
"amount": 100,
"currency": "USD"
},
"event_type": "CASH_TENDER_REFUND",
"id": "0B425480-8504-40B4-A867-37B23543931B"
},
{
"created_at": "2019-11-22T00:44:18.000Z",
"description": "Transfer from another drawer",
"event_money": {
"amount": 10000,
"currency": "USD"
},
"event_type": "PAID_IN",
"id": "8C66E60E-FDCF-4EEF-A98D-3B14B7ED5CBE"
},
{
"created_at": "2019-11-22T00:44:29.000Z",
"description": "Transfer out to another drawer",
"event_money": {
"amount": 10000,
"currency": "USD"
},
"event_type": "PAID_OUT",
"id": "D5ACA7FE-C64D-4ADA-8BC8-82118A2DAE4F"
}
]
}
GET
ListCashDrawerShifts
{{baseUrl}}/v2/cash-drawers/shifts
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/cash-drawers/shifts?location_id=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/cash-drawers/shifts" {:query-params {:location_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/cash-drawers/shifts?location_id="
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/cash-drawers/shifts?location_id="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/cash-drawers/shifts?location_id=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/cash-drawers/shifts?location_id="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/cash-drawers/shifts?location_id= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/cash-drawers/shifts?location_id=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/cash-drawers/shifts?location_id="))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/cash-drawers/shifts?location_id=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/cash-drawers/shifts?location_id=")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/cash-drawers/shifts?location_id=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts',
params: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/cash-drawers/shifts?location_id=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/cash-drawers/shifts?location_id=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/cash-drawers/shifts?location_id=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/cash-drawers/shifts?location_id=',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts',
qs: {location_id: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/cash-drawers/shifts');
req.query({
location_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts',
params: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/cash-drawers/shifts?location_id=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/cash-drawers/shifts?location_id="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/cash-drawers/shifts?location_id=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/cash-drawers/shifts?location_id=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/cash-drawers/shifts?location_id=');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/cash-drawers/shifts');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'location_id' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/cash-drawers/shifts');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'location_id' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/cash-drawers/shifts?location_id=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/cash-drawers/shifts?location_id=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/cash-drawers/shifts?location_id=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/cash-drawers/shifts"
querystring = {"location_id":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/cash-drawers/shifts"
queryString <- list(location_id = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/cash-drawers/shifts?location_id=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/cash-drawers/shifts') do |req|
req.params['location_id'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/cash-drawers/shifts";
let querystring = [
("location_id", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v2/cash-drawers/shifts?location_id='
http GET '{{baseUrl}}/v2/cash-drawers/shifts?location_id='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v2/cash-drawers/shifts?location_id='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/cash-drawers/shifts?location_id=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"items": [
{
"closed_at": "2019-11-22T00:44:49.000Z",
"closed_cash_money": {
"amount": 9970,
"currency": "USD"
},
"description": "Misplaced some change",
"ended_at": "2019-11-22T00:44:49.000Z",
"expected_cash_money": {
"amount": 10000,
"currency": "USD"
},
"id": "DCC99978-09A6-4926-849F-300BE9C5793A",
"opened_at": "2019-11-22T00:42:54.000Z",
"opened_cash_money": {
"amount": 10000,
"currency": "USD"
},
"state": "CLOSED"
}
]
}
GET
RetrieveCashDrawerShift
{{baseUrl}}/v2/cash-drawers/shifts/:shift_id
QUERY PARAMS
location_id
shift_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id" {:query-params {:location_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id="
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/cash-drawers/shifts/:shift_id?location_id= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id="))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id',
params: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/cash-drawers/shifts/:shift_id?location_id=',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id',
qs: {location_id: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id');
req.query({
location_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id',
params: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/cash-drawers/shifts/:shift_id');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'location_id' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/cash-drawers/shifts/:shift_id');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'location_id' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/cash-drawers/shifts/:shift_id?location_id=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id"
querystring = {"location_id":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id"
queryString <- list(location_id = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/cash-drawers/shifts/:shift_id') do |req|
req.params['location_id'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id";
let querystring = [
("location_id", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id='
http GET '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/cash-drawers/shifts/:shift_id?location_id=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cash_drawer_shift": {
"cash_paid_in_money": {
"amount": 10000,
"currency": "USD"
},
"cash_paid_out_money": {
"amount": -10000,
"currency": "USD"
},
"cash_payment_money": {
"amount": 100,
"currency": "USD"
},
"cash_refunds_money": {
"amount": -100,
"currency": "USD"
},
"closed_at": "2019-11-22T00:44:49.000Z",
"closed_cash_money": {
"amount": 9970,
"currency": "USD"
},
"closing_employee_id": "",
"description": "Misplaced some change",
"device": {
"name": "My iPad"
},
"ended_at": "2019-11-22T00:44:49.000Z",
"ending_employee_id": "",
"expected_cash_money": {
"amount": 10000,
"currency": "USD"
},
"id": "DCC99978-09A6-4926-849F-300BE9C5793A",
"opened_at": "2019-11-22T00:42:54.000Z",
"opened_cash_money": {
"amount": 10000,
"currency": "USD"
},
"opening_employee_id": "",
"state": "CLOSED"
}
}
POST
BatchDeleteCatalogObjects
{{baseUrl}}/v2/catalog/batch-delete
BODY json
{
"object_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/batch-delete");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"object_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/catalog/batch-delete" {:content-type :json
:form-params {:object_ids []}})
require "http/client"
url = "{{baseUrl}}/v2/catalog/batch-delete"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"object_ids\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/batch-delete"),
Content = new StringContent("{\n \"object_ids\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/batch-delete");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"object_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/batch-delete"
payload := strings.NewReader("{\n \"object_ids\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/catalog/batch-delete HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 22
{
"object_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/catalog/batch-delete")
.setHeader("content-type", "application/json")
.setBody("{\n \"object_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/batch-delete"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"object_ids\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"object_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/batch-delete")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/catalog/batch-delete")
.header("content-type", "application/json")
.body("{\n \"object_ids\": []\n}")
.asString();
const data = JSON.stringify({
object_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/catalog/batch-delete');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-delete',
headers: {'content-type': 'application/json'},
data: {object_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/batch-delete';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"object_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/batch-delete',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "object_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"object_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/batch-delete")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/batch-delete',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({object_ids: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-delete',
headers: {'content-type': 'application/json'},
body: {object_ids: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/catalog/batch-delete');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
object_ids: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-delete',
headers: {'content-type': 'application/json'},
data: {object_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/batch-delete';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"object_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"object_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/batch-delete"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/batch-delete" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"object_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/batch-delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'object_ids' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/catalog/batch-delete', [
'body' => '{
"object_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/batch-delete');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'object_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'object_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/catalog/batch-delete');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/batch-delete' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"object_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/batch-delete' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"object_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"object_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/catalog/batch-delete", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/batch-delete"
payload = { "object_ids": [] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/batch-delete"
payload <- "{\n \"object_ids\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/batch-delete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"object_ids\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/catalog/batch-delete') do |req|
req.body = "{\n \"object_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/batch-delete";
let payload = json!({"object_ids": ()});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/catalog/batch-delete \
--header 'content-type: application/json' \
--data '{
"object_ids": []
}'
echo '{
"object_ids": []
}' | \
http POST {{baseUrl}}/v2/catalog/batch-delete \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "object_ids": []\n}' \
--output-document \
- {{baseUrl}}/v2/catalog/batch-delete
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["object_ids": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/batch-delete")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"deleted_at": "2016-11-16T22:25:24.878Z",
"deleted_object_ids": [
"W62UWFY35CWMYGVWK6TWJDNI",
"AA27W3M2GGTF3H6AVPNB77CK"
]
}
POST
BatchRetrieveCatalogObjects
{{baseUrl}}/v2/catalog/batch-retrieve
BODY json
{
"catalog_version": 0,
"include_related_objects": false,
"object_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/batch-retrieve");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/catalog/batch-retrieve" {:content-type :json
:form-params {:catalog_version 0
:include_related_objects false
:object_ids []}})
require "http/client"
url = "{{baseUrl}}/v2/catalog/batch-retrieve"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/batch-retrieve"),
Content = new StringContent("{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/batch-retrieve");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/batch-retrieve"
payload := strings.NewReader("{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/catalog/batch-retrieve HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 82
{
"catalog_version": 0,
"include_related_objects": false,
"object_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/catalog/batch-retrieve")
.setHeader("content-type", "application/json")
.setBody("{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/batch-retrieve"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/batch-retrieve")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/catalog/batch-retrieve")
.header("content-type", "application/json")
.body("{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}")
.asString();
const data = JSON.stringify({
catalog_version: 0,
include_related_objects: false,
object_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/catalog/batch-retrieve');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-retrieve',
headers: {'content-type': 'application/json'},
data: {catalog_version: 0, include_related_objects: false, object_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/batch-retrieve';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_version":0,"include_related_objects":false,"object_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/batch-retrieve',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "catalog_version": 0,\n "include_related_objects": false,\n "object_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/batch-retrieve")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/batch-retrieve',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({catalog_version: 0, include_related_objects: false, object_ids: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-retrieve',
headers: {'content-type': 'application/json'},
body: {catalog_version: 0, include_related_objects: false, object_ids: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/catalog/batch-retrieve');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
catalog_version: 0,
include_related_objects: false,
object_ids: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-retrieve',
headers: {'content-type': 'application/json'},
data: {catalog_version: 0, include_related_objects: false, object_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/batch-retrieve';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_version":0,"include_related_objects":false,"object_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"catalog_version": @0,
@"include_related_objects": @NO,
@"object_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/batch-retrieve"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/batch-retrieve" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/batch-retrieve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'catalog_version' => 0,
'include_related_objects' => null,
'object_ids' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/catalog/batch-retrieve', [
'body' => '{
"catalog_version": 0,
"include_related_objects": false,
"object_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/batch-retrieve');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'catalog_version' => 0,
'include_related_objects' => null,
'object_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'catalog_version' => 0,
'include_related_objects' => null,
'object_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/catalog/batch-retrieve');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/batch-retrieve' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_version": 0,
"include_related_objects": false,
"object_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/batch-retrieve' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_version": 0,
"include_related_objects": false,
"object_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/catalog/batch-retrieve", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/batch-retrieve"
payload = {
"catalog_version": 0,
"include_related_objects": False,
"object_ids": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/batch-retrieve"
payload <- "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/batch-retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/catalog/batch-retrieve') do |req|
req.body = "{\n \"catalog_version\": 0,\n \"include_related_objects\": false,\n \"object_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/batch-retrieve";
let payload = json!({
"catalog_version": 0,
"include_related_objects": false,
"object_ids": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/catalog/batch-retrieve \
--header 'content-type: application/json' \
--data '{
"catalog_version": 0,
"include_related_objects": false,
"object_ids": []
}'
echo '{
"catalog_version": 0,
"include_related_objects": false,
"object_ids": []
}' | \
http POST {{baseUrl}}/v2/catalog/batch-retrieve \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "catalog_version": 0,\n "include_related_objects": false,\n "object_ids": []\n}' \
--output-document \
- {{baseUrl}}/v2/catalog/batch-retrieve
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"catalog_version": 0,
"include_related_objects": false,
"object_ids": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/batch-retrieve")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"objects": [
{
"id": "W62UWFY35CWMYGVWK6TWJDNI",
"is_deleted": false,
"item_data": {
"category_id": "BJNQCF2FJ6S6UIDT65ABHLRX",
"description": "Hot Leaf Juice",
"name": "Tea",
"tax_ids": [
"HURXQOOAIC4IZSI2BEXQRYFY"
],
"variations": [
{
"id": "2TZFAOHWGG7PAK2QEXWYPZSP",
"is_deleted": false,
"item_variation_data": {
"item_id": "W62UWFY35CWMYGVWK6TWJDNI",
"name": "Mug",
"ordinal": 0,
"price_money": {
"amount": 150,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
}
]
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
},
{
"id": "AA27W3M2GGTF3H6AVPNB77CK",
"is_deleted": false,
"item_data": {
"category_id": "BJNQCF2FJ6S6UIDT65ABHLRX",
"description": "Hot Bean Juice",
"name": "Coffee",
"tax_ids": [
"HURXQOOAIC4IZSI2BEXQRYFY"
],
"variations": [
{
"id": "LBTYIHNHU52WOIHWT7SNRIYH",
"is_deleted": false,
"item_variation_data": {
"item_id": "AA27W3M2GGTF3H6AVPNB77CK",
"name": "Regular",
"ordinal": 0,
"price_money": {
"amount": 250,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
},
{
"id": "PKYIC7HGGKW5CYVSCVDEIMHY",
"is_deleted": false,
"item_variation_data": {
"item_id": "AA27W3M2GGTF3H6AVPNB77CK",
"name": "Large",
"ordinal": 1,
"price_money": {
"amount": 350,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
}
]
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
}
],
"related_objects": [
{
"category_data": {
"name": "Beverages"
},
"id": "BJNQCF2FJ6S6UIDT65ABHLRX",
"is_deleted": false,
"present_at_all_locations": true,
"type": "CATEGORY",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
},
{
"id": "HURXQOOAIC4IZSI2BEXQRYFY",
"is_deleted": false,
"present_at_all_locations": true,
"tax_data": {
"calculation_phase": "TAX_SUBTOTAL_PHASE",
"enabled": true,
"inclusion_type": "ADDITIVE",
"name": "Sales Tax",
"percentage": "5.0"
},
"type": "TAX",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
}
]
}
POST
BatchUpsertCatalogObjects
{{baseUrl}}/v2/catalog/batch-upsert
BODY json
{
"batches": [
{
"objects": [
{
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
]
}
],
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/batch-upsert");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/catalog/batch-upsert" {:content-type :json
:form-params {:batches [{:objects [{:absent_at_location_ids []
:catalog_v1_ids [{:catalog_v1_id ""
:location_id ""}]
:category_data {:name ""}
:custom_attribute_definition_data {:allowed_object_types []
:app_visibility ""
:custom_attribute_usage_count 0
:description ""
:key ""
:name ""
:number_config {:precision 0}
:selection_config {:allowed_selections [{:name ""
:uid ""}]
:max_allowed_selections 0}
:seller_visibility ""
:source_application {:application_id ""
:name ""
:product ""}
:string_config {:enforce_uniqueness false}
:type ""}
:custom_attribute_values {}
:discount_data {:amount_money {:amount 0
:currency ""}
:discount_type ""
:label_color ""
:modify_tax_basis ""
:name ""
:percentage ""
:pin_required false}
:id ""
:image_data {:caption ""
:name ""
:url ""}
:image_id ""
:is_deleted false
:item_data {:abbreviation ""
:available_electronically false
:available_for_pickup false
:available_online false
:category_id ""
:description ""
:item_options [{:item_option_id ""}]
:label_color ""
:modifier_list_info [{:enabled false
:max_selected_modifiers 0
:min_selected_modifiers 0
:modifier_list_id ""
:modifier_overrides [{:modifier_id ""
:on_by_default false}]}]
:name ""
:product_type ""
:skip_modifier_screen false
:sort_name ""
:tax_ids []
:variations []}
:item_option_data {:description ""
:display_name ""
:name ""
:show_colors false
:values []}
:item_option_value_data {:color ""
:description ""
:item_option_id ""
:name ""
:ordinal 0}
:item_variation_data {:available_for_booking false
:inventory_alert_threshold 0
:inventory_alert_type ""
:item_id ""
:item_option_values [{:item_option_id ""
:item_option_value_id ""}]
:location_overrides [{:inventory_alert_threshold 0
:inventory_alert_type ""
:location_id ""
:price_money {}
:pricing_type ""
:track_inventory false}]
:measurement_unit_id ""
:name ""
:ordinal 0
:price_money {}
:pricing_type ""
:service_duration 0
:sku ""
:stockable false
:stockable_conversion {:nonstockable_quantity ""
:stockable_item_variation_id ""
:stockable_quantity ""}
:team_member_ids []
:track_inventory false
:upc ""
:user_data ""}
:measurement_unit_data {:measurement_unit {:area_unit ""
:custom_unit {:abbreviation ""
:name ""}
:generic_unit ""
:length_unit ""
:time_unit ""
:type ""
:volume_unit ""
:weight_unit ""}
:precision 0}
:modifier_data {:modifier_list_id ""
:name ""
:ordinal 0
:price_money {}}
:modifier_list_data {:modifiers []
:name ""
:ordinal 0
:selection_type ""}
:present_at_all_locations false
:present_at_location_ids []
:pricing_rule_data {:apply_products_id ""
:customer_group_ids_any []
:discount_id ""
:exclude_products_id ""
:exclude_strategy ""
:match_products_id ""
:name ""
:time_period_ids []
:valid_from_date ""
:valid_from_local_time ""
:valid_until_date ""
:valid_until_local_time ""}
:product_set_data {:all_products false
:name ""
:product_ids_all []
:product_ids_any []
:quantity_exact 0
:quantity_max 0
:quantity_min 0}
:quick_amounts_settings_data {:amounts [{:amount {}
:ordinal 0
:score 0
:type ""}]
:eligible_for_auto_amounts false
:option ""}
:subscription_plan_data {:name ""
:phases [{:cadence ""
:ordinal 0
:periods 0
:recurring_price_money {}
:uid ""}]}
:tax_data {:applies_to_custom_amounts false
:calculation_phase ""
:enabled false
:inclusion_type ""
:name ""
:percentage ""}
:time_period_data {:event ""}
:type ""
:updated_at ""
:version 0}]}]
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/catalog/batch-upsert"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/batch-upsert"),
Content = new StringContent("{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/batch-upsert");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/batch-upsert"
payload := strings.NewReader("{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/catalog/batch-upsert HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 7023
{
"batches": [
{
"objects": [
{
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
]
}
],
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/catalog/batch-upsert")
.setHeader("content-type", "application/json")
.setBody("{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/batch-upsert"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/batch-upsert")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/catalog/batch-upsert")
.header("content-type", "application/json")
.body("{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
batches: [
{
objects: [
{
absent_at_location_ids: [],
catalog_v1_ids: [
{
catalog_v1_id: '',
location_id: ''
}
],
category_data: {
name: ''
},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {
precision: 0
},
selection_config: {
allowed_selections: [
{
name: '',
uid: ''
}
],
max_allowed_selections: 0
},
seller_visibility: '',
source_application: {
application_id: '',
name: '',
product: ''
},
string_config: {
enforce_uniqueness: false
},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {
amount: 0,
currency: ''
},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {
caption: '',
name: '',
url: ''
},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [
{
item_option_id: ''
}
],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [
{
modifier_id: '',
on_by_default: false
}
]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {
description: '',
display_name: '',
name: '',
show_colors: false,
values: []
},
item_option_value_data: {
color: '',
description: '',
item_option_id: '',
name: '',
ordinal: 0
},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [
{
item_option_id: '',
item_option_value_id: ''
}
],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {
modifier_list_id: '',
name: '',
ordinal: 0,
price_money: {}
},
modifier_list_data: {
modifiers: [],
name: '',
ordinal: 0,
selection_type: ''
},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [
{
amount: {},
ordinal: 0,
score: 0,
type: ''
}
],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [
{
cadence: '',
ordinal: 0,
periods: 0,
recurring_price_money: {},
uid: ''
}
]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {
event: ''
},
type: '',
updated_at: '',
version: 0
}
]
}
],
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/catalog/batch-upsert');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-upsert',
headers: {'content-type': 'application/json'},
data: {
batches: [
{
objects: [
{
absent_at_location_ids: [],
catalog_v1_ids: [{catalog_v1_id: '', location_id: ''}],
category_data: {name: ''},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {precision: 0},
selection_config: {allowed_selections: [{name: '', uid: ''}], max_allowed_selections: 0},
seller_visibility: '',
source_application: {application_id: '', name: '', product: ''},
string_config: {enforce_uniqueness: false},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {amount: 0, currency: ''},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {caption: '', name: '', url: ''},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [{item_option_id: ''}],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [{modifier_id: '', on_by_default: false}]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {description: '', display_name: '', name: '', show_colors: false, values: []},
item_option_value_data: {color: '', description: '', item_option_id: '', name: '', ordinal: 0},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [{item_option_id: '', item_option_value_id: ''}],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {modifier_list_id: '', name: '', ordinal: 0, price_money: {}},
modifier_list_data: {modifiers: [], name: '', ordinal: 0, selection_type: ''},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [{amount: {}, ordinal: 0, score: 0, type: ''}],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [{cadence: '', ordinal: 0, periods: 0, recurring_price_money: {}, uid: ''}]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {event: ''},
type: '',
updated_at: '',
version: 0
}
]
}
],
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/batch-upsert';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"batches":[{"objects":[{"absent_at_location_ids":[],"catalog_v1_ids":[{"catalog_v1_id":"","location_id":""}],"category_data":{"name":""},"custom_attribute_definition_data":{"allowed_object_types":[],"app_visibility":"","custom_attribute_usage_count":0,"description":"","key":"","name":"","number_config":{"precision":0},"selection_config":{"allowed_selections":[{"name":"","uid":""}],"max_allowed_selections":0},"seller_visibility":"","source_application":{"application_id":"","name":"","product":""},"string_config":{"enforce_uniqueness":false},"type":""},"custom_attribute_values":{},"discount_data":{"amount_money":{"amount":0,"currency":""},"discount_type":"","label_color":"","modify_tax_basis":"","name":"","percentage":"","pin_required":false},"id":"","image_data":{"caption":"","name":"","url":""},"image_id":"","is_deleted":false,"item_data":{"abbreviation":"","available_electronically":false,"available_for_pickup":false,"available_online":false,"category_id":"","description":"","item_options":[{"item_option_id":""}],"label_color":"","modifier_list_info":[{"enabled":false,"max_selected_modifiers":0,"min_selected_modifiers":0,"modifier_list_id":"","modifier_overrides":[{"modifier_id":"","on_by_default":false}]}],"name":"","product_type":"","skip_modifier_screen":false,"sort_name":"","tax_ids":[],"variations":[]},"item_option_data":{"description":"","display_name":"","name":"","show_colors":false,"values":[]},"item_option_value_data":{"color":"","description":"","item_option_id":"","name":"","ordinal":0},"item_variation_data":{"available_for_booking":false,"inventory_alert_threshold":0,"inventory_alert_type":"","item_id":"","item_option_values":[{"item_option_id":"","item_option_value_id":""}],"location_overrides":[{"inventory_alert_threshold":0,"inventory_alert_type":"","location_id":"","price_money":{},"pricing_type":"","track_inventory":false}],"measurement_unit_id":"","name":"","ordinal":0,"price_money":{},"pricing_type":"","service_duration":0,"sku":"","stockable":false,"stockable_conversion":{"nonstockable_quantity":"","stockable_item_variation_id":"","stockable_quantity":""},"team_member_ids":[],"track_inventory":false,"upc":"","user_data":""},"measurement_unit_data":{"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"modifier_data":{"modifier_list_id":"","name":"","ordinal":0,"price_money":{}},"modifier_list_data":{"modifiers":[],"name":"","ordinal":0,"selection_type":""},"present_at_all_locations":false,"present_at_location_ids":[],"pricing_rule_data":{"apply_products_id":"","customer_group_ids_any":[],"discount_id":"","exclude_products_id":"","exclude_strategy":"","match_products_id":"","name":"","time_period_ids":[],"valid_from_date":"","valid_from_local_time":"","valid_until_date":"","valid_until_local_time":""},"product_set_data":{"all_products":false,"name":"","product_ids_all":[],"product_ids_any":[],"quantity_exact":0,"quantity_max":0,"quantity_min":0},"quick_amounts_settings_data":{"amounts":[{"amount":{},"ordinal":0,"score":0,"type":""}],"eligible_for_auto_amounts":false,"option":""},"subscription_plan_data":{"name":"","phases":[{"cadence":"","ordinal":0,"periods":0,"recurring_price_money":{},"uid":""}]},"tax_data":{"applies_to_custom_amounts":false,"calculation_phase":"","enabled":false,"inclusion_type":"","name":"","percentage":""},"time_period_data":{"event":""},"type":"","updated_at":"","version":0}]}],"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/batch-upsert',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "batches": [\n {\n "objects": [\n {\n "absent_at_location_ids": [],\n "catalog_v1_ids": [\n {\n "catalog_v1_id": "",\n "location_id": ""\n }\n ],\n "category_data": {\n "name": ""\n },\n "custom_attribute_definition_data": {\n "allowed_object_types": [],\n "app_visibility": "",\n "custom_attribute_usage_count": 0,\n "description": "",\n "key": "",\n "name": "",\n "number_config": {\n "precision": 0\n },\n "selection_config": {\n "allowed_selections": [\n {\n "name": "",\n "uid": ""\n }\n ],\n "max_allowed_selections": 0\n },\n "seller_visibility": "",\n "source_application": {\n "application_id": "",\n "name": "",\n "product": ""\n },\n "string_config": {\n "enforce_uniqueness": false\n },\n "type": ""\n },\n "custom_attribute_values": {},\n "discount_data": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "discount_type": "",\n "label_color": "",\n "modify_tax_basis": "",\n "name": "",\n "percentage": "",\n "pin_required": false\n },\n "id": "",\n "image_data": {\n "caption": "",\n "name": "",\n "url": ""\n },\n "image_id": "",\n "is_deleted": false,\n "item_data": {\n "abbreviation": "",\n "available_electronically": false,\n "available_for_pickup": false,\n "available_online": false,\n "category_id": "",\n "description": "",\n "item_options": [\n {\n "item_option_id": ""\n }\n ],\n "label_color": "",\n "modifier_list_info": [\n {\n "enabled": false,\n "max_selected_modifiers": 0,\n "min_selected_modifiers": 0,\n "modifier_list_id": "",\n "modifier_overrides": [\n {\n "modifier_id": "",\n "on_by_default": false\n }\n ]\n }\n ],\n "name": "",\n "product_type": "",\n "skip_modifier_screen": false,\n "sort_name": "",\n "tax_ids": [],\n "variations": []\n },\n "item_option_data": {\n "description": "",\n "display_name": "",\n "name": "",\n "show_colors": false,\n "values": []\n },\n "item_option_value_data": {\n "color": "",\n "description": "",\n "item_option_id": "",\n "name": "",\n "ordinal": 0\n },\n "item_variation_data": {\n "available_for_booking": false,\n "inventory_alert_threshold": 0,\n "inventory_alert_type": "",\n "item_id": "",\n "item_option_values": [\n {\n "item_option_id": "",\n "item_option_value_id": ""\n }\n ],\n "location_overrides": [\n {\n "inventory_alert_threshold": 0,\n "inventory_alert_type": "",\n "location_id": "",\n "price_money": {},\n "pricing_type": "",\n "track_inventory": false\n }\n ],\n "measurement_unit_id": "",\n "name": "",\n "ordinal": 0,\n "price_money": {},\n "pricing_type": "",\n "service_duration": 0,\n "sku": "",\n "stockable": false,\n "stockable_conversion": {\n "nonstockable_quantity": "",\n "stockable_item_variation_id": "",\n "stockable_quantity": ""\n },\n "team_member_ids": [],\n "track_inventory": false,\n "upc": "",\n "user_data": ""\n },\n "measurement_unit_data": {\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "modifier_data": {\n "modifier_list_id": "",\n "name": "",\n "ordinal": 0,\n "price_money": {}\n },\n "modifier_list_data": {\n "modifiers": [],\n "name": "",\n "ordinal": 0,\n "selection_type": ""\n },\n "present_at_all_locations": false,\n "present_at_location_ids": [],\n "pricing_rule_data": {\n "apply_products_id": "",\n "customer_group_ids_any": [],\n "discount_id": "",\n "exclude_products_id": "",\n "exclude_strategy": "",\n "match_products_id": "",\n "name": "",\n "time_period_ids": [],\n "valid_from_date": "",\n "valid_from_local_time": "",\n "valid_until_date": "",\n "valid_until_local_time": ""\n },\n "product_set_data": {\n "all_products": false,\n "name": "",\n "product_ids_all": [],\n "product_ids_any": [],\n "quantity_exact": 0,\n "quantity_max": 0,\n "quantity_min": 0\n },\n "quick_amounts_settings_data": {\n "amounts": [\n {\n "amount": {},\n "ordinal": 0,\n "score": 0,\n "type": ""\n }\n ],\n "eligible_for_auto_amounts": false,\n "option": ""\n },\n "subscription_plan_data": {\n "name": "",\n "phases": [\n {\n "cadence": "",\n "ordinal": 0,\n "periods": 0,\n "recurring_price_money": {},\n "uid": ""\n }\n ]\n },\n "tax_data": {\n "applies_to_custom_amounts": false,\n "calculation_phase": "",\n "enabled": false,\n "inclusion_type": "",\n "name": "",\n "percentage": ""\n },\n "time_period_data": {\n "event": ""\n },\n "type": "",\n "updated_at": "",\n "version": 0\n }\n ]\n }\n ],\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/batch-upsert")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/batch-upsert',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
batches: [
{
objects: [
{
absent_at_location_ids: [],
catalog_v1_ids: [{catalog_v1_id: '', location_id: ''}],
category_data: {name: ''},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {precision: 0},
selection_config: {allowed_selections: [{name: '', uid: ''}], max_allowed_selections: 0},
seller_visibility: '',
source_application: {application_id: '', name: '', product: ''},
string_config: {enforce_uniqueness: false},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {amount: 0, currency: ''},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {caption: '', name: '', url: ''},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [{item_option_id: ''}],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [{modifier_id: '', on_by_default: false}]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {description: '', display_name: '', name: '', show_colors: false, values: []},
item_option_value_data: {color: '', description: '', item_option_id: '', name: '', ordinal: 0},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [{item_option_id: '', item_option_value_id: ''}],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {modifier_list_id: '', name: '', ordinal: 0, price_money: {}},
modifier_list_data: {modifiers: [], name: '', ordinal: 0, selection_type: ''},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [{amount: {}, ordinal: 0, score: 0, type: ''}],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [{cadence: '', ordinal: 0, periods: 0, recurring_price_money: {}, uid: ''}]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {event: ''},
type: '',
updated_at: '',
version: 0
}
]
}
],
idempotency_key: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-upsert',
headers: {'content-type': 'application/json'},
body: {
batches: [
{
objects: [
{
absent_at_location_ids: [],
catalog_v1_ids: [{catalog_v1_id: '', location_id: ''}],
category_data: {name: ''},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {precision: 0},
selection_config: {allowed_selections: [{name: '', uid: ''}], max_allowed_selections: 0},
seller_visibility: '',
source_application: {application_id: '', name: '', product: ''},
string_config: {enforce_uniqueness: false},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {amount: 0, currency: ''},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {caption: '', name: '', url: ''},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [{item_option_id: ''}],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [{modifier_id: '', on_by_default: false}]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {description: '', display_name: '', name: '', show_colors: false, values: []},
item_option_value_data: {color: '', description: '', item_option_id: '', name: '', ordinal: 0},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [{item_option_id: '', item_option_value_id: ''}],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {modifier_list_id: '', name: '', ordinal: 0, price_money: {}},
modifier_list_data: {modifiers: [], name: '', ordinal: 0, selection_type: ''},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [{amount: {}, ordinal: 0, score: 0, type: ''}],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [{cadence: '', ordinal: 0, periods: 0, recurring_price_money: {}, uid: ''}]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {event: ''},
type: '',
updated_at: '',
version: 0
}
]
}
],
idempotency_key: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/catalog/batch-upsert');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
batches: [
{
objects: [
{
absent_at_location_ids: [],
catalog_v1_ids: [
{
catalog_v1_id: '',
location_id: ''
}
],
category_data: {
name: ''
},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {
precision: 0
},
selection_config: {
allowed_selections: [
{
name: '',
uid: ''
}
],
max_allowed_selections: 0
},
seller_visibility: '',
source_application: {
application_id: '',
name: '',
product: ''
},
string_config: {
enforce_uniqueness: false
},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {
amount: 0,
currency: ''
},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {
caption: '',
name: '',
url: ''
},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [
{
item_option_id: ''
}
],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [
{
modifier_id: '',
on_by_default: false
}
]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {
description: '',
display_name: '',
name: '',
show_colors: false,
values: []
},
item_option_value_data: {
color: '',
description: '',
item_option_id: '',
name: '',
ordinal: 0
},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [
{
item_option_id: '',
item_option_value_id: ''
}
],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {
modifier_list_id: '',
name: '',
ordinal: 0,
price_money: {}
},
modifier_list_data: {
modifiers: [],
name: '',
ordinal: 0,
selection_type: ''
},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [
{
amount: {},
ordinal: 0,
score: 0,
type: ''
}
],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [
{
cadence: '',
ordinal: 0,
periods: 0,
recurring_price_money: {},
uid: ''
}
]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {
event: ''
},
type: '',
updated_at: '',
version: 0
}
]
}
],
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/batch-upsert',
headers: {'content-type': 'application/json'},
data: {
batches: [
{
objects: [
{
absent_at_location_ids: [],
catalog_v1_ids: [{catalog_v1_id: '', location_id: ''}],
category_data: {name: ''},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {precision: 0},
selection_config: {allowed_selections: [{name: '', uid: ''}], max_allowed_selections: 0},
seller_visibility: '',
source_application: {application_id: '', name: '', product: ''},
string_config: {enforce_uniqueness: false},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {amount: 0, currency: ''},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {caption: '', name: '', url: ''},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [{item_option_id: ''}],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [{modifier_id: '', on_by_default: false}]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {description: '', display_name: '', name: '', show_colors: false, values: []},
item_option_value_data: {color: '', description: '', item_option_id: '', name: '', ordinal: 0},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [{item_option_id: '', item_option_value_id: ''}],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {modifier_list_id: '', name: '', ordinal: 0, price_money: {}},
modifier_list_data: {modifiers: [], name: '', ordinal: 0, selection_type: ''},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [{amount: {}, ordinal: 0, score: 0, type: ''}],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [{cadence: '', ordinal: 0, periods: 0, recurring_price_money: {}, uid: ''}]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {event: ''},
type: '',
updated_at: '',
version: 0
}
]
}
],
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/batch-upsert';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"batches":[{"objects":[{"absent_at_location_ids":[],"catalog_v1_ids":[{"catalog_v1_id":"","location_id":""}],"category_data":{"name":""},"custom_attribute_definition_data":{"allowed_object_types":[],"app_visibility":"","custom_attribute_usage_count":0,"description":"","key":"","name":"","number_config":{"precision":0},"selection_config":{"allowed_selections":[{"name":"","uid":""}],"max_allowed_selections":0},"seller_visibility":"","source_application":{"application_id":"","name":"","product":""},"string_config":{"enforce_uniqueness":false},"type":""},"custom_attribute_values":{},"discount_data":{"amount_money":{"amount":0,"currency":""},"discount_type":"","label_color":"","modify_tax_basis":"","name":"","percentage":"","pin_required":false},"id":"","image_data":{"caption":"","name":"","url":""},"image_id":"","is_deleted":false,"item_data":{"abbreviation":"","available_electronically":false,"available_for_pickup":false,"available_online":false,"category_id":"","description":"","item_options":[{"item_option_id":""}],"label_color":"","modifier_list_info":[{"enabled":false,"max_selected_modifiers":0,"min_selected_modifiers":0,"modifier_list_id":"","modifier_overrides":[{"modifier_id":"","on_by_default":false}]}],"name":"","product_type":"","skip_modifier_screen":false,"sort_name":"","tax_ids":[],"variations":[]},"item_option_data":{"description":"","display_name":"","name":"","show_colors":false,"values":[]},"item_option_value_data":{"color":"","description":"","item_option_id":"","name":"","ordinal":0},"item_variation_data":{"available_for_booking":false,"inventory_alert_threshold":0,"inventory_alert_type":"","item_id":"","item_option_values":[{"item_option_id":"","item_option_value_id":""}],"location_overrides":[{"inventory_alert_threshold":0,"inventory_alert_type":"","location_id":"","price_money":{},"pricing_type":"","track_inventory":false}],"measurement_unit_id":"","name":"","ordinal":0,"price_money":{},"pricing_type":"","service_duration":0,"sku":"","stockable":false,"stockable_conversion":{"nonstockable_quantity":"","stockable_item_variation_id":"","stockable_quantity":""},"team_member_ids":[],"track_inventory":false,"upc":"","user_data":""},"measurement_unit_data":{"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"modifier_data":{"modifier_list_id":"","name":"","ordinal":0,"price_money":{}},"modifier_list_data":{"modifiers":[],"name":"","ordinal":0,"selection_type":""},"present_at_all_locations":false,"present_at_location_ids":[],"pricing_rule_data":{"apply_products_id":"","customer_group_ids_any":[],"discount_id":"","exclude_products_id":"","exclude_strategy":"","match_products_id":"","name":"","time_period_ids":[],"valid_from_date":"","valid_from_local_time":"","valid_until_date":"","valid_until_local_time":""},"product_set_data":{"all_products":false,"name":"","product_ids_all":[],"product_ids_any":[],"quantity_exact":0,"quantity_max":0,"quantity_min":0},"quick_amounts_settings_data":{"amounts":[{"amount":{},"ordinal":0,"score":0,"type":""}],"eligible_for_auto_amounts":false,"option":""},"subscription_plan_data":{"name":"","phases":[{"cadence":"","ordinal":0,"periods":0,"recurring_price_money":{},"uid":""}]},"tax_data":{"applies_to_custom_amounts":false,"calculation_phase":"","enabled":false,"inclusion_type":"","name":"","percentage":""},"time_period_data":{"event":""},"type":"","updated_at":"","version":0}]}],"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"batches": @[ @{ @"objects": @[ @{ @"absent_at_location_ids": @[ ], @"catalog_v1_ids": @[ @{ @"catalog_v1_id": @"", @"location_id": @"" } ], @"category_data": @{ @"name": @"" }, @"custom_attribute_definition_data": @{ @"allowed_object_types": @[ ], @"app_visibility": @"", @"custom_attribute_usage_count": @0, @"description": @"", @"key": @"", @"name": @"", @"number_config": @{ @"precision": @0 }, @"selection_config": @{ @"allowed_selections": @[ @{ @"name": @"", @"uid": @"" } ], @"max_allowed_selections": @0 }, @"seller_visibility": @"", @"source_application": @{ @"application_id": @"", @"name": @"", @"product": @"" }, @"string_config": @{ @"enforce_uniqueness": @NO }, @"type": @"" }, @"custom_attribute_values": @{ }, @"discount_data": @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"discount_type": @"", @"label_color": @"", @"modify_tax_basis": @"", @"name": @"", @"percentage": @"", @"pin_required": @NO }, @"id": @"", @"image_data": @{ @"caption": @"", @"name": @"", @"url": @"" }, @"image_id": @"", @"is_deleted": @NO, @"item_data": @{ @"abbreviation": @"", @"available_electronically": @NO, @"available_for_pickup": @NO, @"available_online": @NO, @"category_id": @"", @"description": @"", @"item_options": @[ @{ @"item_option_id": @"" } ], @"label_color": @"", @"modifier_list_info": @[ @{ @"enabled": @NO, @"max_selected_modifiers": @0, @"min_selected_modifiers": @0, @"modifier_list_id": @"", @"modifier_overrides": @[ @{ @"modifier_id": @"", @"on_by_default": @NO } ] } ], @"name": @"", @"product_type": @"", @"skip_modifier_screen": @NO, @"sort_name": @"", @"tax_ids": @[ ], @"variations": @[ ] }, @"item_option_data": @{ @"description": @"", @"display_name": @"", @"name": @"", @"show_colors": @NO, @"values": @[ ] }, @"item_option_value_data": @{ @"color": @"", @"description": @"", @"item_option_id": @"", @"name": @"", @"ordinal": @0 }, @"item_variation_data": @{ @"available_for_booking": @NO, @"inventory_alert_threshold": @0, @"inventory_alert_type": @"", @"item_id": @"", @"item_option_values": @[ @{ @"item_option_id": @"", @"item_option_value_id": @"" } ], @"location_overrides": @[ @{ @"inventory_alert_threshold": @0, @"inventory_alert_type": @"", @"location_id": @"", @"price_money": @{ }, @"pricing_type": @"", @"track_inventory": @NO } ], @"measurement_unit_id": @"", @"name": @"", @"ordinal": @0, @"price_money": @{ }, @"pricing_type": @"", @"service_duration": @0, @"sku": @"", @"stockable": @NO, @"stockable_conversion": @{ @"nonstockable_quantity": @"", @"stockable_item_variation_id": @"", @"stockable_quantity": @"" }, @"team_member_ids": @[ ], @"track_inventory": @NO, @"upc": @"", @"user_data": @"" }, @"measurement_unit_data": @{ @"measurement_unit": @{ @"area_unit": @"", @"custom_unit": @{ @"abbreviation": @"", @"name": @"" }, @"generic_unit": @"", @"length_unit": @"", @"time_unit": @"", @"type": @"", @"volume_unit": @"", @"weight_unit": @"" }, @"precision": @0 }, @"modifier_data": @{ @"modifier_list_id": @"", @"name": @"", @"ordinal": @0, @"price_money": @{ } }, @"modifier_list_data": @{ @"modifiers": @[ ], @"name": @"", @"ordinal": @0, @"selection_type": @"" }, @"present_at_all_locations": @NO, @"present_at_location_ids": @[ ], @"pricing_rule_data": @{ @"apply_products_id": @"", @"customer_group_ids_any": @[ ], @"discount_id": @"", @"exclude_products_id": @"", @"exclude_strategy": @"", @"match_products_id": @"", @"name": @"", @"time_period_ids": @[ ], @"valid_from_date": @"", @"valid_from_local_time": @"", @"valid_until_date": @"", @"valid_until_local_time": @"" }, @"product_set_data": @{ @"all_products": @NO, @"name": @"", @"product_ids_all": @[ ], @"product_ids_any": @[ ], @"quantity_exact": @0, @"quantity_max": @0, @"quantity_min": @0 }, @"quick_amounts_settings_data": @{ @"amounts": @[ @{ @"amount": @{ }, @"ordinal": @0, @"score": @0, @"type": @"" } ], @"eligible_for_auto_amounts": @NO, @"option": @"" }, @"subscription_plan_data": @{ @"name": @"", @"phases": @[ @{ @"cadence": @"", @"ordinal": @0, @"periods": @0, @"recurring_price_money": @{ }, @"uid": @"" } ] }, @"tax_data": @{ @"applies_to_custom_amounts": @NO, @"calculation_phase": @"", @"enabled": @NO, @"inclusion_type": @"", @"name": @"", @"percentage": @"" }, @"time_period_data": @{ @"event": @"" }, @"type": @"", @"updated_at": @"", @"version": @0 } ] } ],
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/batch-upsert"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/batch-upsert" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/batch-upsert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'batches' => [
[
'objects' => [
[
'absent_at_location_ids' => [
],
'catalog_v1_ids' => [
[
'catalog_v1_id' => '',
'location_id' => ''
]
],
'category_data' => [
'name' => ''
],
'custom_attribute_definition_data' => [
'allowed_object_types' => [
],
'app_visibility' => '',
'custom_attribute_usage_count' => 0,
'description' => '',
'key' => '',
'name' => '',
'number_config' => [
'precision' => 0
],
'selection_config' => [
'allowed_selections' => [
[
'name' => '',
'uid' => ''
]
],
'max_allowed_selections' => 0
],
'seller_visibility' => '',
'source_application' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'string_config' => [
'enforce_uniqueness' => null
],
'type' => ''
],
'custom_attribute_values' => [
],
'discount_data' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'discount_type' => '',
'label_color' => '',
'modify_tax_basis' => '',
'name' => '',
'percentage' => '',
'pin_required' => null
],
'id' => '',
'image_data' => [
'caption' => '',
'name' => '',
'url' => ''
],
'image_id' => '',
'is_deleted' => null,
'item_data' => [
'abbreviation' => '',
'available_electronically' => null,
'available_for_pickup' => null,
'available_online' => null,
'category_id' => '',
'description' => '',
'item_options' => [
[
'item_option_id' => ''
]
],
'label_color' => '',
'modifier_list_info' => [
[
'enabled' => null,
'max_selected_modifiers' => 0,
'min_selected_modifiers' => 0,
'modifier_list_id' => '',
'modifier_overrides' => [
[
'modifier_id' => '',
'on_by_default' => null
]
]
]
],
'name' => '',
'product_type' => '',
'skip_modifier_screen' => null,
'sort_name' => '',
'tax_ids' => [
],
'variations' => [
]
],
'item_option_data' => [
'description' => '',
'display_name' => '',
'name' => '',
'show_colors' => null,
'values' => [
]
],
'item_option_value_data' => [
'color' => '',
'description' => '',
'item_option_id' => '',
'name' => '',
'ordinal' => 0
],
'item_variation_data' => [
'available_for_booking' => null,
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'item_id' => '',
'item_option_values' => [
[
'item_option_id' => '',
'item_option_value_id' => ''
]
],
'location_overrides' => [
[
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'location_id' => '',
'price_money' => [
],
'pricing_type' => '',
'track_inventory' => null
]
],
'measurement_unit_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
],
'pricing_type' => '',
'service_duration' => 0,
'sku' => '',
'stockable' => null,
'stockable_conversion' => [
'nonstockable_quantity' => '',
'stockable_item_variation_id' => '',
'stockable_quantity' => ''
],
'team_member_ids' => [
],
'track_inventory' => null,
'upc' => '',
'user_data' => ''
],
'measurement_unit_data' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'modifier_data' => [
'modifier_list_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
]
],
'modifier_list_data' => [
'modifiers' => [
],
'name' => '',
'ordinal' => 0,
'selection_type' => ''
],
'present_at_all_locations' => null,
'present_at_location_ids' => [
],
'pricing_rule_data' => [
'apply_products_id' => '',
'customer_group_ids_any' => [
],
'discount_id' => '',
'exclude_products_id' => '',
'exclude_strategy' => '',
'match_products_id' => '',
'name' => '',
'time_period_ids' => [
],
'valid_from_date' => '',
'valid_from_local_time' => '',
'valid_until_date' => '',
'valid_until_local_time' => ''
],
'product_set_data' => [
'all_products' => null,
'name' => '',
'product_ids_all' => [
],
'product_ids_any' => [
],
'quantity_exact' => 0,
'quantity_max' => 0,
'quantity_min' => 0
],
'quick_amounts_settings_data' => [
'amounts' => [
[
'amount' => [
],
'ordinal' => 0,
'score' => 0,
'type' => ''
]
],
'eligible_for_auto_amounts' => null,
'option' => ''
],
'subscription_plan_data' => [
'name' => '',
'phases' => [
[
'cadence' => '',
'ordinal' => 0,
'periods' => 0,
'recurring_price_money' => [
],
'uid' => ''
]
]
],
'tax_data' => [
'applies_to_custom_amounts' => null,
'calculation_phase' => '',
'enabled' => null,
'inclusion_type' => '',
'name' => '',
'percentage' => ''
],
'time_period_data' => [
'event' => ''
],
'type' => '',
'updated_at' => '',
'version' => 0
]
]
]
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/catalog/batch-upsert', [
'body' => '{
"batches": [
{
"objects": [
{
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
]
}
],
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/batch-upsert');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'batches' => [
[
'objects' => [
[
'absent_at_location_ids' => [
],
'catalog_v1_ids' => [
[
'catalog_v1_id' => '',
'location_id' => ''
]
],
'category_data' => [
'name' => ''
],
'custom_attribute_definition_data' => [
'allowed_object_types' => [
],
'app_visibility' => '',
'custom_attribute_usage_count' => 0,
'description' => '',
'key' => '',
'name' => '',
'number_config' => [
'precision' => 0
],
'selection_config' => [
'allowed_selections' => [
[
'name' => '',
'uid' => ''
]
],
'max_allowed_selections' => 0
],
'seller_visibility' => '',
'source_application' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'string_config' => [
'enforce_uniqueness' => null
],
'type' => ''
],
'custom_attribute_values' => [
],
'discount_data' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'discount_type' => '',
'label_color' => '',
'modify_tax_basis' => '',
'name' => '',
'percentage' => '',
'pin_required' => null
],
'id' => '',
'image_data' => [
'caption' => '',
'name' => '',
'url' => ''
],
'image_id' => '',
'is_deleted' => null,
'item_data' => [
'abbreviation' => '',
'available_electronically' => null,
'available_for_pickup' => null,
'available_online' => null,
'category_id' => '',
'description' => '',
'item_options' => [
[
'item_option_id' => ''
]
],
'label_color' => '',
'modifier_list_info' => [
[
'enabled' => null,
'max_selected_modifiers' => 0,
'min_selected_modifiers' => 0,
'modifier_list_id' => '',
'modifier_overrides' => [
[
'modifier_id' => '',
'on_by_default' => null
]
]
]
],
'name' => '',
'product_type' => '',
'skip_modifier_screen' => null,
'sort_name' => '',
'tax_ids' => [
],
'variations' => [
]
],
'item_option_data' => [
'description' => '',
'display_name' => '',
'name' => '',
'show_colors' => null,
'values' => [
]
],
'item_option_value_data' => [
'color' => '',
'description' => '',
'item_option_id' => '',
'name' => '',
'ordinal' => 0
],
'item_variation_data' => [
'available_for_booking' => null,
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'item_id' => '',
'item_option_values' => [
[
'item_option_id' => '',
'item_option_value_id' => ''
]
],
'location_overrides' => [
[
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'location_id' => '',
'price_money' => [
],
'pricing_type' => '',
'track_inventory' => null
]
],
'measurement_unit_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
],
'pricing_type' => '',
'service_duration' => 0,
'sku' => '',
'stockable' => null,
'stockable_conversion' => [
'nonstockable_quantity' => '',
'stockable_item_variation_id' => '',
'stockable_quantity' => ''
],
'team_member_ids' => [
],
'track_inventory' => null,
'upc' => '',
'user_data' => ''
],
'measurement_unit_data' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'modifier_data' => [
'modifier_list_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
]
],
'modifier_list_data' => [
'modifiers' => [
],
'name' => '',
'ordinal' => 0,
'selection_type' => ''
],
'present_at_all_locations' => null,
'present_at_location_ids' => [
],
'pricing_rule_data' => [
'apply_products_id' => '',
'customer_group_ids_any' => [
],
'discount_id' => '',
'exclude_products_id' => '',
'exclude_strategy' => '',
'match_products_id' => '',
'name' => '',
'time_period_ids' => [
],
'valid_from_date' => '',
'valid_from_local_time' => '',
'valid_until_date' => '',
'valid_until_local_time' => ''
],
'product_set_data' => [
'all_products' => null,
'name' => '',
'product_ids_all' => [
],
'product_ids_any' => [
],
'quantity_exact' => 0,
'quantity_max' => 0,
'quantity_min' => 0
],
'quick_amounts_settings_data' => [
'amounts' => [
[
'amount' => [
],
'ordinal' => 0,
'score' => 0,
'type' => ''
]
],
'eligible_for_auto_amounts' => null,
'option' => ''
],
'subscription_plan_data' => [
'name' => '',
'phases' => [
[
'cadence' => '',
'ordinal' => 0,
'periods' => 0,
'recurring_price_money' => [
],
'uid' => ''
]
]
],
'tax_data' => [
'applies_to_custom_amounts' => null,
'calculation_phase' => '',
'enabled' => null,
'inclusion_type' => '',
'name' => '',
'percentage' => ''
],
'time_period_data' => [
'event' => ''
],
'type' => '',
'updated_at' => '',
'version' => 0
]
]
]
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'batches' => [
[
'objects' => [
[
'absent_at_location_ids' => [
],
'catalog_v1_ids' => [
[
'catalog_v1_id' => '',
'location_id' => ''
]
],
'category_data' => [
'name' => ''
],
'custom_attribute_definition_data' => [
'allowed_object_types' => [
],
'app_visibility' => '',
'custom_attribute_usage_count' => 0,
'description' => '',
'key' => '',
'name' => '',
'number_config' => [
'precision' => 0
],
'selection_config' => [
'allowed_selections' => [
[
'name' => '',
'uid' => ''
]
],
'max_allowed_selections' => 0
],
'seller_visibility' => '',
'source_application' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'string_config' => [
'enforce_uniqueness' => null
],
'type' => ''
],
'custom_attribute_values' => [
],
'discount_data' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'discount_type' => '',
'label_color' => '',
'modify_tax_basis' => '',
'name' => '',
'percentage' => '',
'pin_required' => null
],
'id' => '',
'image_data' => [
'caption' => '',
'name' => '',
'url' => ''
],
'image_id' => '',
'is_deleted' => null,
'item_data' => [
'abbreviation' => '',
'available_electronically' => null,
'available_for_pickup' => null,
'available_online' => null,
'category_id' => '',
'description' => '',
'item_options' => [
[
'item_option_id' => ''
]
],
'label_color' => '',
'modifier_list_info' => [
[
'enabled' => null,
'max_selected_modifiers' => 0,
'min_selected_modifiers' => 0,
'modifier_list_id' => '',
'modifier_overrides' => [
[
'modifier_id' => '',
'on_by_default' => null
]
]
]
],
'name' => '',
'product_type' => '',
'skip_modifier_screen' => null,
'sort_name' => '',
'tax_ids' => [
],
'variations' => [
]
],
'item_option_data' => [
'description' => '',
'display_name' => '',
'name' => '',
'show_colors' => null,
'values' => [
]
],
'item_option_value_data' => [
'color' => '',
'description' => '',
'item_option_id' => '',
'name' => '',
'ordinal' => 0
],
'item_variation_data' => [
'available_for_booking' => null,
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'item_id' => '',
'item_option_values' => [
[
'item_option_id' => '',
'item_option_value_id' => ''
]
],
'location_overrides' => [
[
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'location_id' => '',
'price_money' => [
],
'pricing_type' => '',
'track_inventory' => null
]
],
'measurement_unit_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
],
'pricing_type' => '',
'service_duration' => 0,
'sku' => '',
'stockable' => null,
'stockable_conversion' => [
'nonstockable_quantity' => '',
'stockable_item_variation_id' => '',
'stockable_quantity' => ''
],
'team_member_ids' => [
],
'track_inventory' => null,
'upc' => '',
'user_data' => ''
],
'measurement_unit_data' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'modifier_data' => [
'modifier_list_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
]
],
'modifier_list_data' => [
'modifiers' => [
],
'name' => '',
'ordinal' => 0,
'selection_type' => ''
],
'present_at_all_locations' => null,
'present_at_location_ids' => [
],
'pricing_rule_data' => [
'apply_products_id' => '',
'customer_group_ids_any' => [
],
'discount_id' => '',
'exclude_products_id' => '',
'exclude_strategy' => '',
'match_products_id' => '',
'name' => '',
'time_period_ids' => [
],
'valid_from_date' => '',
'valid_from_local_time' => '',
'valid_until_date' => '',
'valid_until_local_time' => ''
],
'product_set_data' => [
'all_products' => null,
'name' => '',
'product_ids_all' => [
],
'product_ids_any' => [
],
'quantity_exact' => 0,
'quantity_max' => 0,
'quantity_min' => 0
],
'quick_amounts_settings_data' => [
'amounts' => [
[
'amount' => [
],
'ordinal' => 0,
'score' => 0,
'type' => ''
]
],
'eligible_for_auto_amounts' => null,
'option' => ''
],
'subscription_plan_data' => [
'name' => '',
'phases' => [
[
'cadence' => '',
'ordinal' => 0,
'periods' => 0,
'recurring_price_money' => [
],
'uid' => ''
]
]
],
'tax_data' => [
'applies_to_custom_amounts' => null,
'calculation_phase' => '',
'enabled' => null,
'inclusion_type' => '',
'name' => '',
'percentage' => ''
],
'time_period_data' => [
'event' => ''
],
'type' => '',
'updated_at' => '',
'version' => 0
]
]
]
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/catalog/batch-upsert');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/batch-upsert' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"batches": [
{
"objects": [
{
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
]
}
],
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/batch-upsert' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"batches": [
{
"objects": [
{
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
]
}
],
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/catalog/batch-upsert", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/batch-upsert"
payload = {
"batches": [{ "objects": [
{
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": { "name": "" },
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": { "precision": 0 },
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": { "enforce_uniqueness": False },
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": False
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": False,
"item_data": {
"abbreviation": "",
"available_electronically": False,
"available_for_pickup": False,
"available_online": False,
"category_id": "",
"description": "",
"item_options": [{ "item_option_id": "" }],
"label_color": "",
"modifier_list_info": [
{
"enabled": False,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": False
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": False,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": False,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": False,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": False
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": False,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": False,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": False,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": False,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": False,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": False,
"calculation_phase": "",
"enabled": False,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": { "event": "" },
"type": "",
"updated_at": "",
"version": 0
}
] }],
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/batch-upsert"
payload <- "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/batch-upsert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/catalog/batch-upsert') do |req|
req.body = "{\n \"batches\": [\n {\n \"objects\": [\n {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n ]\n }\n ],\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/batch-upsert";
let payload = json!({
"batches": (json!({"objects": (
json!({
"absent_at_location_ids": (),
"catalog_v1_ids": (
json!({
"catalog_v1_id": "",
"location_id": ""
})
),
"category_data": json!({"name": ""}),
"custom_attribute_definition_data": json!({
"allowed_object_types": (),
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": json!({"precision": 0}),
"selection_config": json!({
"allowed_selections": (
json!({
"name": "",
"uid": ""
})
),
"max_allowed_selections": 0
}),
"seller_visibility": "",
"source_application": json!({
"application_id": "",
"name": "",
"product": ""
}),
"string_config": json!({"enforce_uniqueness": false}),
"type": ""
}),
"custom_attribute_values": json!({}),
"discount_data": json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
}),
"id": "",
"image_data": json!({
"caption": "",
"name": "",
"url": ""
}),
"image_id": "",
"is_deleted": false,
"item_data": json!({
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": (json!({"item_option_id": ""})),
"label_color": "",
"modifier_list_info": (
json!({
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": (
json!({
"modifier_id": "",
"on_by_default": false
})
)
})
),
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": (),
"variations": ()
}),
"item_option_data": json!({
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": ()
}),
"item_option_value_data": json!({
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
}),
"item_variation_data": json!({
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": (
json!({
"item_option_id": "",
"item_option_value_id": ""
})
),
"location_overrides": (
json!({
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": json!({}),
"pricing_type": "",
"track_inventory": false
})
),
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": json!({}),
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": json!({
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
}),
"team_member_ids": (),
"track_inventory": false,
"upc": "",
"user_data": ""
}),
"measurement_unit_data": json!({
"measurement_unit": json!({
"area_unit": "",
"custom_unit": json!({
"abbreviation": "",
"name": ""
}),
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
}),
"precision": 0
}),
"modifier_data": json!({
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": json!({})
}),
"modifier_list_data": json!({
"modifiers": (),
"name": "",
"ordinal": 0,
"selection_type": ""
}),
"present_at_all_locations": false,
"present_at_location_ids": (),
"pricing_rule_data": json!({
"apply_products_id": "",
"customer_group_ids_any": (),
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": (),
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
}),
"product_set_data": json!({
"all_products": false,
"name": "",
"product_ids_all": (),
"product_ids_any": (),
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
}),
"quick_amounts_settings_data": json!({
"amounts": (
json!({
"amount": json!({}),
"ordinal": 0,
"score": 0,
"type": ""
})
),
"eligible_for_auto_amounts": false,
"option": ""
}),
"subscription_plan_data": json!({
"name": "",
"phases": (
json!({
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": json!({}),
"uid": ""
})
)
}),
"tax_data": json!({
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
}),
"time_period_data": json!({"event": ""}),
"type": "",
"updated_at": "",
"version": 0
})
)})),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/catalog/batch-upsert \
--header 'content-type: application/json' \
--data '{
"batches": [
{
"objects": [
{
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
]
}
],
"idempotency_key": ""
}'
echo '{
"batches": [
{
"objects": [
{
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
]
}
],
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/catalog/batch-upsert \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "batches": [\n {\n "objects": [\n {\n "absent_at_location_ids": [],\n "catalog_v1_ids": [\n {\n "catalog_v1_id": "",\n "location_id": ""\n }\n ],\n "category_data": {\n "name": ""\n },\n "custom_attribute_definition_data": {\n "allowed_object_types": [],\n "app_visibility": "",\n "custom_attribute_usage_count": 0,\n "description": "",\n "key": "",\n "name": "",\n "number_config": {\n "precision": 0\n },\n "selection_config": {\n "allowed_selections": [\n {\n "name": "",\n "uid": ""\n }\n ],\n "max_allowed_selections": 0\n },\n "seller_visibility": "",\n "source_application": {\n "application_id": "",\n "name": "",\n "product": ""\n },\n "string_config": {\n "enforce_uniqueness": false\n },\n "type": ""\n },\n "custom_attribute_values": {},\n "discount_data": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "discount_type": "",\n "label_color": "",\n "modify_tax_basis": "",\n "name": "",\n "percentage": "",\n "pin_required": false\n },\n "id": "",\n "image_data": {\n "caption": "",\n "name": "",\n "url": ""\n },\n "image_id": "",\n "is_deleted": false,\n "item_data": {\n "abbreviation": "",\n "available_electronically": false,\n "available_for_pickup": false,\n "available_online": false,\n "category_id": "",\n "description": "",\n "item_options": [\n {\n "item_option_id": ""\n }\n ],\n "label_color": "",\n "modifier_list_info": [\n {\n "enabled": false,\n "max_selected_modifiers": 0,\n "min_selected_modifiers": 0,\n "modifier_list_id": "",\n "modifier_overrides": [\n {\n "modifier_id": "",\n "on_by_default": false\n }\n ]\n }\n ],\n "name": "",\n "product_type": "",\n "skip_modifier_screen": false,\n "sort_name": "",\n "tax_ids": [],\n "variations": []\n },\n "item_option_data": {\n "description": "",\n "display_name": "",\n "name": "",\n "show_colors": false,\n "values": []\n },\n "item_option_value_data": {\n "color": "",\n "description": "",\n "item_option_id": "",\n "name": "",\n "ordinal": 0\n },\n "item_variation_data": {\n "available_for_booking": false,\n "inventory_alert_threshold": 0,\n "inventory_alert_type": "",\n "item_id": "",\n "item_option_values": [\n {\n "item_option_id": "",\n "item_option_value_id": ""\n }\n ],\n "location_overrides": [\n {\n "inventory_alert_threshold": 0,\n "inventory_alert_type": "",\n "location_id": "",\n "price_money": {},\n "pricing_type": "",\n "track_inventory": false\n }\n ],\n "measurement_unit_id": "",\n "name": "",\n "ordinal": 0,\n "price_money": {},\n "pricing_type": "",\n "service_duration": 0,\n "sku": "",\n "stockable": false,\n "stockable_conversion": {\n "nonstockable_quantity": "",\n "stockable_item_variation_id": "",\n "stockable_quantity": ""\n },\n "team_member_ids": [],\n "track_inventory": false,\n "upc": "",\n "user_data": ""\n },\n "measurement_unit_data": {\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "modifier_data": {\n "modifier_list_id": "",\n "name": "",\n "ordinal": 0,\n "price_money": {}\n },\n "modifier_list_data": {\n "modifiers": [],\n "name": "",\n "ordinal": 0,\n "selection_type": ""\n },\n "present_at_all_locations": false,\n "present_at_location_ids": [],\n "pricing_rule_data": {\n "apply_products_id": "",\n "customer_group_ids_any": [],\n "discount_id": "",\n "exclude_products_id": "",\n "exclude_strategy": "",\n "match_products_id": "",\n "name": "",\n "time_period_ids": [],\n "valid_from_date": "",\n "valid_from_local_time": "",\n "valid_until_date": "",\n "valid_until_local_time": ""\n },\n "product_set_data": {\n "all_products": false,\n "name": "",\n "product_ids_all": [],\n "product_ids_any": [],\n "quantity_exact": 0,\n "quantity_max": 0,\n "quantity_min": 0\n },\n "quick_amounts_settings_data": {\n "amounts": [\n {\n "amount": {},\n "ordinal": 0,\n "score": 0,\n "type": ""\n }\n ],\n "eligible_for_auto_amounts": false,\n "option": ""\n },\n "subscription_plan_data": {\n "name": "",\n "phases": [\n {\n "cadence": "",\n "ordinal": 0,\n "periods": 0,\n "recurring_price_money": {},\n "uid": ""\n }\n ]\n },\n "tax_data": {\n "applies_to_custom_amounts": false,\n "calculation_phase": "",\n "enabled": false,\n "inclusion_type": "",\n "name": "",\n "percentage": ""\n },\n "time_period_data": {\n "event": ""\n },\n "type": "",\n "updated_at": "",\n "version": 0\n }\n ]\n }\n ],\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/catalog/batch-upsert
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"batches": [["objects": [
[
"absent_at_location_ids": [],
"catalog_v1_ids": [
[
"catalog_v1_id": "",
"location_id": ""
]
],
"category_data": ["name": ""],
"custom_attribute_definition_data": [
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": ["precision": 0],
"selection_config": [
"allowed_selections": [
[
"name": "",
"uid": ""
]
],
"max_allowed_selections": 0
],
"seller_visibility": "",
"source_application": [
"application_id": "",
"name": "",
"product": ""
],
"string_config": ["enforce_uniqueness": false],
"type": ""
],
"custom_attribute_values": [],
"discount_data": [
"amount_money": [
"amount": 0,
"currency": ""
],
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
],
"id": "",
"image_data": [
"caption": "",
"name": "",
"url": ""
],
"image_id": "",
"is_deleted": false,
"item_data": [
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [["item_option_id": ""]],
"label_color": "",
"modifier_list_info": [
[
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
[
"modifier_id": "",
"on_by_default": false
]
]
]
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
],
"item_option_data": [
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
],
"item_option_value_data": [
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
],
"item_variation_data": [
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
[
"item_option_id": "",
"item_option_value_id": ""
]
],
"location_overrides": [
[
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": [],
"pricing_type": "",
"track_inventory": false
]
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": [],
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": [
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
],
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
],
"measurement_unit_data": [
"measurement_unit": [
"area_unit": "",
"custom_unit": [
"abbreviation": "",
"name": ""
],
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
],
"precision": 0
],
"modifier_data": [
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": []
],
"modifier_list_data": [
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
],
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": [
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
],
"product_set_data": [
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
],
"quick_amounts_settings_data": [
"amounts": [
[
"amount": [],
"ordinal": 0,
"score": 0,
"type": ""
]
],
"eligible_for_auto_amounts": false,
"option": ""
],
"subscription_plan_data": [
"name": "",
"phases": [
[
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": [],
"uid": ""
]
]
],
"tax_data": [
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
],
"time_period_data": ["event": ""],
"type": "",
"updated_at": "",
"version": 0
]
]]],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/batch-upsert")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"id_mappings": [
{
"client_object_id": "#Tea",
"object_id": "ZSDZN34NAXDLC6D5ZQMNSOUM"
},
{
"client_object_id": "#Coffee",
"object_id": "PJMCEBHHUS3OKDB6PYUHLCPP"
},
{
"client_object_id": "#Beverages",
"object_id": "LYT72K3WGJFFCIMB63XARP3I"
},
{
"client_object_id": "#SalesTax",
"object_id": "XHSHLHNWSI3HVI4BW5ZUZXI3"
},
{
"client_object_id": "#Tea_Mug",
"object_id": "NAYHET5R52MIYCEF34ZMAHFM"
},
{
"client_object_id": "#Coffee_Regular",
"object_id": "OTYDX45SPG7LJQUVCBZI4INH"
},
{
"client_object_id": "#Coffee_Large",
"object_id": "GZDA3JB37FYVOPI4AOEBOITI"
}
],
"objects": [
{
"id": "ZSDZN34NAXDLC6D5ZQMNSOUM",
"is_deleted": false,
"item_data": {
"category_id": "LYT72K3WGJFFCIMB63XARP3I",
"description": "Hot Leaf Juice",
"name": "Tea",
"tax_ids": [
"XHSHLHNWSI3HVI4BW5ZUZXI3"
],
"variations": [
{
"id": "NAYHET5R52MIYCEF34ZMAHFM",
"is_deleted": false,
"item_variation_data": {
"item_id": "ZSDZN34NAXDLC6D5ZQMNSOUM",
"name": "Mug",
"ordinal": 0,
"price_money": {
"amount": 150,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2017-05-10T18:48:39.798Z",
"version": 1494442119798
}
]
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2017-05-10T18:48:39.798Z",
"version": 1494442119798
},
{
"id": "PJMCEBHHUS3OKDB6PYUHLCPP",
"is_deleted": false,
"item_data": {
"category_id": "LYT72K3WGJFFCIMB63XARP3I",
"description": "Hot Bean Juice",
"name": "Coffee",
"tax_ids": [
"XHSHLHNWSI3HVI4BW5ZUZXI3"
],
"variations": [
{
"id": "OTYDX45SPG7LJQUVCBZI4INH",
"is_deleted": false,
"item_variation_data": {
"item_id": "PJMCEBHHUS3OKDB6PYUHLCPP",
"name": "Regular",
"ordinal": 0,
"price_money": {
"amount": 250,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2017-05-10T18:48:39.798Z",
"version": 1494442119798
},
{
"id": "GZDA3JB37FYVOPI4AOEBOITI",
"is_deleted": false,
"item_variation_data": {
"item_id": "PJMCEBHHUS3OKDB6PYUHLCPP",
"name": "Large",
"ordinal": 1,
"price_money": {
"amount": 350,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2017-05-10T18:48:39.798Z",
"version": 1494442119798
}
]
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2017-05-10T18:48:39.798Z",
"version": 1494442119798
},
{
"category_data": {
"name": "Beverages"
},
"id": "LYT72K3WGJFFCIMB63XARP3I",
"is_deleted": false,
"present_at_all_locations": true,
"type": "CATEGORY",
"updated_at": "2017-05-10T18:48:39.798Z",
"version": 1494442119798
},
{
"id": "XHSHLHNWSI3HVI4BW5ZUZXI3",
"is_deleted": false,
"present_at_all_locations": true,
"tax_data": {
"applies_to_custom_amounts": true,
"calculation_phase": "TAX_SUBTOTAL_PHASE",
"enabled": true,
"inclusion_type": "ADDITIVE",
"name": "Sales Tax",
"percentage": "5.0"
},
"type": "TAX",
"updated_at": "2017-05-10T18:48:39.798Z",
"version": 1494442119798
}
]
}
GET
CatalogInfo
{{baseUrl}}/v2/catalog/info
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/info");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/catalog/info")
require "http/client"
url = "{{baseUrl}}/v2/catalog/info"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/info"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/info");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/info"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/catalog/info HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/catalog/info")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/info"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/info")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/catalog/info")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/catalog/info');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/info'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/info';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/info',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/info")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/info',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/info'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/catalog/info');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/info'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/info';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/info"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/info" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/info",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/catalog/info');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/info');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/catalog/info');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/info' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/info' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/catalog/info")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/info"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/info"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/info")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/catalog/info') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/info";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/catalog/info
http GET {{baseUrl}}/v2/catalog/info
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/catalog/info
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/info")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"limits": {
"batch_delete_max_object_ids": 200,
"batch_retrieve_max_object_ids": 1000,
"batch_upsert_max_objects_per_batch": 1000,
"batch_upsert_max_total_objects": 10000,
"search_max_page_limit": 1000,
"update_item_modifier_lists_max_item_ids": 1000,
"update_item_modifier_lists_max_modifier_lists_to_disable": 1000,
"update_item_modifier_lists_max_modifier_lists_to_enable": 1000,
"update_item_taxes_max_item_ids": 1000,
"update_item_taxes_max_taxes_to_disable": 1000,
"update_item_taxes_max_taxes_to_enable": 1000
}
}
DELETE
DeleteCatalogObject
{{baseUrl}}/v2/catalog/object/:object_id
QUERY PARAMS
object_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/object/:object_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/catalog/object/:object_id")
require "http/client"
url = "{{baseUrl}}/v2/catalog/object/:object_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/object/:object_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/object/:object_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/object/:object_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/catalog/object/:object_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/catalog/object/:object_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/object/:object_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/object/:object_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/catalog/object/:object_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/catalog/object/:object_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/catalog/object/:object_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/object/:object_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/object/:object_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/object/:object_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/object/:object_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/catalog/object/:object_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/catalog/object/:object_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/catalog/object/:object_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/object/:object_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/object/:object_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/object/:object_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/object/:object_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/catalog/object/:object_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/object/:object_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/catalog/object/:object_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/object/:object_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/object/:object_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/catalog/object/:object_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/object/:object_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/object/:object_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/object/:object_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/catalog/object/:object_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/object/:object_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/catalog/object/:object_id
http DELETE {{baseUrl}}/v2/catalog/object/:object_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/catalog/object/:object_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/object/:object_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"deleted_at": "2016-11-16T22:25:24.878Z",
"deleted_object_ids": [
"7SB3ZQYJ5GDMVFL7JK46JCHT",
"KQLFFHA6K6J3YQAQAWDQAL57"
]
}
GET
ListCatalog
{{baseUrl}}/v2/catalog/list
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/list");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/catalog/list")
require "http/client"
url = "{{baseUrl}}/v2/catalog/list"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/list"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/list");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/list"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/catalog/list HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/catalog/list")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/list"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/list")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/catalog/list")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/catalog/list');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/list'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/list';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/list',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/list")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/list',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/list'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/catalog/list');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/list'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/list';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/list"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/list" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/list",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/catalog/list');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/list');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/catalog/list');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/list' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/list' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/catalog/list")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/list"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/list"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/list")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/catalog/list') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/list";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/catalog/list
http GET {{baseUrl}}/v2/catalog/list
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/catalog/list
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/list")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"objects": [
{
"category_data": {
"name": "Beverages"
},
"id": "5ZYQZZ2IECPVJ2IJ5KQPRDC3",
"is_deleted": false,
"present_at_all_locations": true,
"type": "CATEGORY",
"updated_at": "2017-02-21T14:50:26.495Z",
"version": 1487688626495
},
{
"id": "L5R47DGBZOOVKCAFIXC56AEN",
"is_deleted": false,
"present_at_all_locations": true,
"tax_data": {
"calculation_phase": "TAX_SUBTOTAL_PHASE",
"enabled": true,
"inclusion_type": "ADDITIVE",
"name": "Sales Tax",
"percentage": "5.0"
},
"type": "TAX",
"updated_at": "2017-02-21T14:50:26.495Z",
"version": 1487688626495
}
]
}
GET
RetrieveCatalogObject
{{baseUrl}}/v2/catalog/object/:object_id
QUERY PARAMS
object_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/object/:object_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/catalog/object/:object_id")
require "http/client"
url = "{{baseUrl}}/v2/catalog/object/:object_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/object/:object_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/object/:object_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/object/:object_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/catalog/object/:object_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/catalog/object/:object_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/object/:object_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/object/:object_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/catalog/object/:object_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/catalog/object/:object_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/object/:object_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/object/:object_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/object/:object_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/object/:object_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/object/:object_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/object/:object_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/catalog/object/:object_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/catalog/object/:object_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/object/:object_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/object/:object_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/object/:object_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/object/:object_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/catalog/object/:object_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/object/:object_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/catalog/object/:object_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/object/:object_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/object/:object_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/catalog/object/:object_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/object/:object_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/object/:object_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/object/:object_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/catalog/object/:object_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/object/:object_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/catalog/object/:object_id
http GET {{baseUrl}}/v2/catalog/object/:object_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/catalog/object/:object_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/object/:object_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"object": {
"id": "W62UWFY35CWMYGVWK6TWJDNI",
"is_deleted": false,
"item_data": {
"category_id": "BJNQCF2FJ6S6UIDT65ABHLRX",
"description": "Hot Leaf Juice",
"name": "Tea",
"tax_ids": [
"HURXQOOAIC4IZSI2BEXQRYFY"
],
"variations": [
{
"id": "2TZFAOHWGG7PAK2QEXWYPZSP",
"is_deleted": false,
"item_variation_data": {
"item_id": "W62UWFY35CWMYGVWK6TWJDNI",
"name": "Mug",
"ordinal": 0,
"price_money": {
"amount": 150,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
}
]
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
},
"related_objects": [
{
"category_data": {
"name": "Beverages"
},
"id": "BJNQCF2FJ6S6UIDT65ABHLRX",
"is_deleted": false,
"present_at_all_locations": true,
"type": "CATEGORY",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
},
{
"id": "HURXQOOAIC4IZSI2BEXQRYFY",
"is_deleted": false,
"present_at_all_locations": true,
"tax_data": {
"calculation_phase": "TAX_SUBTOTAL_PHASE",
"enabled": true,
"inclusion_type": "ADDITIVE",
"name": "Sales Tax",
"percentage": "5.0"
},
"type": "TAX",
"updated_at": "2016-11-16T22:25:24.878Z",
"version": 1479335124878
}
]
}
POST
SearchCatalogItems
{{baseUrl}}/v2/catalog/search-catalog-items
BODY json
{
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
{
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": {
"max": "",
"min": ""
},
"selection_uids_filter": [],
"string_filter": ""
}
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/search-catalog-items");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/catalog/search-catalog-items" {:content-type :json
:form-params {:category_ids []
:cursor ""
:custom_attribute_filters [{:bool_filter false
:custom_attribute_definition_id ""
:key ""
:number_filter {:max ""
:min ""}
:selection_uids_filter []
:string_filter ""}]
:enabled_location_ids []
:limit 0
:product_types []
:sort_order ""
:stock_levels []
:text_filter ""}})
require "http/client"
url = "{{baseUrl}}/v2/catalog/search-catalog-items"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/search-catalog-items"),
Content = new StringContent("{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/search-catalog-items");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/search-catalog-items"
payload := strings.NewReader("{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/catalog/search-catalog-items HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 440
{
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
{
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": {
"max": "",
"min": ""
},
"selection_uids_filter": [],
"string_filter": ""
}
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/catalog/search-catalog-items")
.setHeader("content-type", "application/json")
.setBody("{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/search-catalog-items"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/search-catalog-items")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/catalog/search-catalog-items")
.header("content-type", "application/json")
.body("{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}")
.asString();
const data = JSON.stringify({
category_ids: [],
cursor: '',
custom_attribute_filters: [
{
bool_filter: false,
custom_attribute_definition_id: '',
key: '',
number_filter: {
max: '',
min: ''
},
selection_uids_filter: [],
string_filter: ''
}
],
enabled_location_ids: [],
limit: 0,
product_types: [],
sort_order: '',
stock_levels: [],
text_filter: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/catalog/search-catalog-items');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/search-catalog-items',
headers: {'content-type': 'application/json'},
data: {
category_ids: [],
cursor: '',
custom_attribute_filters: [
{
bool_filter: false,
custom_attribute_definition_id: '',
key: '',
number_filter: {max: '', min: ''},
selection_uids_filter: [],
string_filter: ''
}
],
enabled_location_ids: [],
limit: 0,
product_types: [],
sort_order: '',
stock_levels: [],
text_filter: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/search-catalog-items';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"category_ids":[],"cursor":"","custom_attribute_filters":[{"bool_filter":false,"custom_attribute_definition_id":"","key":"","number_filter":{"max":"","min":""},"selection_uids_filter":[],"string_filter":""}],"enabled_location_ids":[],"limit":0,"product_types":[],"sort_order":"","stock_levels":[],"text_filter":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/search-catalog-items',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "category_ids": [],\n "cursor": "",\n "custom_attribute_filters": [\n {\n "bool_filter": false,\n "custom_attribute_definition_id": "",\n "key": "",\n "number_filter": {\n "max": "",\n "min": ""\n },\n "selection_uids_filter": [],\n "string_filter": ""\n }\n ],\n "enabled_location_ids": [],\n "limit": 0,\n "product_types": [],\n "sort_order": "",\n "stock_levels": [],\n "text_filter": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/search-catalog-items")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/search-catalog-items',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
category_ids: [],
cursor: '',
custom_attribute_filters: [
{
bool_filter: false,
custom_attribute_definition_id: '',
key: '',
number_filter: {max: '', min: ''},
selection_uids_filter: [],
string_filter: ''
}
],
enabled_location_ids: [],
limit: 0,
product_types: [],
sort_order: '',
stock_levels: [],
text_filter: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/search-catalog-items',
headers: {'content-type': 'application/json'},
body: {
category_ids: [],
cursor: '',
custom_attribute_filters: [
{
bool_filter: false,
custom_attribute_definition_id: '',
key: '',
number_filter: {max: '', min: ''},
selection_uids_filter: [],
string_filter: ''
}
],
enabled_location_ids: [],
limit: 0,
product_types: [],
sort_order: '',
stock_levels: [],
text_filter: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/catalog/search-catalog-items');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
category_ids: [],
cursor: '',
custom_attribute_filters: [
{
bool_filter: false,
custom_attribute_definition_id: '',
key: '',
number_filter: {
max: '',
min: ''
},
selection_uids_filter: [],
string_filter: ''
}
],
enabled_location_ids: [],
limit: 0,
product_types: [],
sort_order: '',
stock_levels: [],
text_filter: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/search-catalog-items',
headers: {'content-type': 'application/json'},
data: {
category_ids: [],
cursor: '',
custom_attribute_filters: [
{
bool_filter: false,
custom_attribute_definition_id: '',
key: '',
number_filter: {max: '', min: ''},
selection_uids_filter: [],
string_filter: ''
}
],
enabled_location_ids: [],
limit: 0,
product_types: [],
sort_order: '',
stock_levels: [],
text_filter: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/search-catalog-items';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"category_ids":[],"cursor":"","custom_attribute_filters":[{"bool_filter":false,"custom_attribute_definition_id":"","key":"","number_filter":{"max":"","min":""},"selection_uids_filter":[],"string_filter":""}],"enabled_location_ids":[],"limit":0,"product_types":[],"sort_order":"","stock_levels":[],"text_filter":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"category_ids": @[ ],
@"cursor": @"",
@"custom_attribute_filters": @[ @{ @"bool_filter": @NO, @"custom_attribute_definition_id": @"", @"key": @"", @"number_filter": @{ @"max": @"", @"min": @"" }, @"selection_uids_filter": @[ ], @"string_filter": @"" } ],
@"enabled_location_ids": @[ ],
@"limit": @0,
@"product_types": @[ ],
@"sort_order": @"",
@"stock_levels": @[ ],
@"text_filter": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/search-catalog-items"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/search-catalog-items" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/search-catalog-items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'category_ids' => [
],
'cursor' => '',
'custom_attribute_filters' => [
[
'bool_filter' => null,
'custom_attribute_definition_id' => '',
'key' => '',
'number_filter' => [
'max' => '',
'min' => ''
],
'selection_uids_filter' => [
],
'string_filter' => ''
]
],
'enabled_location_ids' => [
],
'limit' => 0,
'product_types' => [
],
'sort_order' => '',
'stock_levels' => [
],
'text_filter' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/catalog/search-catalog-items', [
'body' => '{
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
{
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": {
"max": "",
"min": ""
},
"selection_uids_filter": [],
"string_filter": ""
}
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/search-catalog-items');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'category_ids' => [
],
'cursor' => '',
'custom_attribute_filters' => [
[
'bool_filter' => null,
'custom_attribute_definition_id' => '',
'key' => '',
'number_filter' => [
'max' => '',
'min' => ''
],
'selection_uids_filter' => [
],
'string_filter' => ''
]
],
'enabled_location_ids' => [
],
'limit' => 0,
'product_types' => [
],
'sort_order' => '',
'stock_levels' => [
],
'text_filter' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'category_ids' => [
],
'cursor' => '',
'custom_attribute_filters' => [
[
'bool_filter' => null,
'custom_attribute_definition_id' => '',
'key' => '',
'number_filter' => [
'max' => '',
'min' => ''
],
'selection_uids_filter' => [
],
'string_filter' => ''
]
],
'enabled_location_ids' => [
],
'limit' => 0,
'product_types' => [
],
'sort_order' => '',
'stock_levels' => [
],
'text_filter' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/catalog/search-catalog-items');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/search-catalog-items' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
{
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": {
"max": "",
"min": ""
},
"selection_uids_filter": [],
"string_filter": ""
}
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/search-catalog-items' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
{
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": {
"max": "",
"min": ""
},
"selection_uids_filter": [],
"string_filter": ""
}
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/catalog/search-catalog-items", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/search-catalog-items"
payload = {
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
{
"bool_filter": False,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": {
"max": "",
"min": ""
},
"selection_uids_filter": [],
"string_filter": ""
}
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/search-catalog-items"
payload <- "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/search-catalog-items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/catalog/search-catalog-items') do |req|
req.body = "{\n \"category_ids\": [],\n \"cursor\": \"\",\n \"custom_attribute_filters\": [\n {\n \"bool_filter\": false,\n \"custom_attribute_definition_id\": \"\",\n \"key\": \"\",\n \"number_filter\": {\n \"max\": \"\",\n \"min\": \"\"\n },\n \"selection_uids_filter\": [],\n \"string_filter\": \"\"\n }\n ],\n \"enabled_location_ids\": [],\n \"limit\": 0,\n \"product_types\": [],\n \"sort_order\": \"\",\n \"stock_levels\": [],\n \"text_filter\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/search-catalog-items";
let payload = json!({
"category_ids": (),
"cursor": "",
"custom_attribute_filters": (
json!({
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": json!({
"max": "",
"min": ""
}),
"selection_uids_filter": (),
"string_filter": ""
})
),
"enabled_location_ids": (),
"limit": 0,
"product_types": (),
"sort_order": "",
"stock_levels": (),
"text_filter": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/catalog/search-catalog-items \
--header 'content-type: application/json' \
--data '{
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
{
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": {
"max": "",
"min": ""
},
"selection_uids_filter": [],
"string_filter": ""
}
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
}'
echo '{
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
{
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": {
"max": "",
"min": ""
},
"selection_uids_filter": [],
"string_filter": ""
}
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
}' | \
http POST {{baseUrl}}/v2/catalog/search-catalog-items \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "category_ids": [],\n "cursor": "",\n "custom_attribute_filters": [\n {\n "bool_filter": false,\n "custom_attribute_definition_id": "",\n "key": "",\n "number_filter": {\n "max": "",\n "min": ""\n },\n "selection_uids_filter": [],\n "string_filter": ""\n }\n ],\n "enabled_location_ids": [],\n "limit": 0,\n "product_types": [],\n "sort_order": "",\n "stock_levels": [],\n "text_filter": ""\n}' \
--output-document \
- {{baseUrl}}/v2/catalog/search-catalog-items
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"category_ids": [],
"cursor": "",
"custom_attribute_filters": [
[
"bool_filter": false,
"custom_attribute_definition_id": "",
"key": "",
"number_filter": [
"max": "",
"min": ""
],
"selection_uids_filter": [],
"string_filter": ""
]
],
"enabled_location_ids": [],
"limit": 0,
"product_types": [],
"sort_order": "",
"stock_levels": [],
"text_filter": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/search-catalog-items")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"items": [
{
"custom_attribute_values": {
"BRAND": {
"custom_attribute_definition_id": "BRAND_DEFINITION_ID",
"key": "BRAND",
"name": "Brand",
"string_value": "Dark Horse",
"type": "STRING"
},
"VARIETAL": {
"custom_attribute_definition_id": "VARIETAL_DEFINITION_ID",
"key": "VARIETAL",
"name": "Varietal",
"selection_uid_values": [
"MERLOT_SELECTION_ID",
null
],
"type": "SELECTION"
},
"VINTAGE": {
"custom_attribute_definition_id": "EI7IJQDUKYSHULREPIPH6HNU",
"key": "VINTAGE",
"name": "Vintage",
"number_value": 2018,
"type": "NUMBER"
}
},
"id": "GPOKJPTV2KDLVKCADJ7I77EZ",
"is_deleted": false,
"item_data": {
"description": "A nice red wine",
"name": "Dark Horse Merlot 2018",
"product_type": "REGULAR",
"variations": [
{
"id": "VBJNPHCOKDFECR6VU25WRJUD",
"is_deleted": false,
"item_variation_data": {
"item_id": "GPOKJPTV2KDLVKCADJ7I77EZ",
"name": "750 mL",
"ordinal": 0,
"price_money": {
"amount": 1000,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2020-06-18T17:55:56.646Z",
"version": 1592502956646
}
]
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2020-06-18T17:55:56.646Z",
"version": 1592502956646
}
],
"matched_variation_ids": [
"VBJNPHCOKDFECR6VU25WRJUD"
]
}
POST
SearchCatalogObjects
{{baseUrl}}/v2/catalog/search
BODY json
{
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": [],
"query": {
"exact_query": {
"attribute_name": "",
"attribute_value": ""
},
"item_variations_for_item_option_values_query": {
"item_option_value_ids": []
},
"items_for_item_options_query": {
"item_option_ids": []
},
"items_for_modifier_list_query": {
"modifier_list_ids": []
},
"items_for_tax_query": {
"tax_ids": []
},
"prefix_query": {
"attribute_name": "",
"attribute_prefix": ""
},
"range_query": {
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
},
"set_query": {
"attribute_name": "",
"attribute_values": []
},
"sorted_attribute_query": {
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
},
"text_query": {
"keywords": []
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/catalog/search" {:content-type :json
:form-params {:begin_time ""
:cursor ""
:include_deleted_objects false
:include_related_objects false
:limit 0
:object_types []
:query {:exact_query {:attribute_name ""
:attribute_value ""}
:item_variations_for_item_option_values_query {:item_option_value_ids []}
:items_for_item_options_query {:item_option_ids []}
:items_for_modifier_list_query {:modifier_list_ids []}
:items_for_tax_query {:tax_ids []}
:prefix_query {:attribute_name ""
:attribute_prefix ""}
:range_query {:attribute_max_value 0
:attribute_min_value 0
:attribute_name ""}
:set_query {:attribute_name ""
:attribute_values []}
:sorted_attribute_query {:attribute_name ""
:initial_attribute_value ""
:sort_order ""}
:text_query {:keywords []}}}})
require "http/client"
url = "{{baseUrl}}/v2/catalog/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/search"),
Content = new StringContent("{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/search"
payload := strings.NewReader("{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/catalog/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1010
{
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": [],
"query": {
"exact_query": {
"attribute_name": "",
"attribute_value": ""
},
"item_variations_for_item_option_values_query": {
"item_option_value_ids": []
},
"items_for_item_options_query": {
"item_option_ids": []
},
"items_for_modifier_list_query": {
"modifier_list_ids": []
},
"items_for_tax_query": {
"tax_ids": []
},
"prefix_query": {
"attribute_name": "",
"attribute_prefix": ""
},
"range_query": {
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
},
"set_query": {
"attribute_name": "",
"attribute_values": []
},
"sorted_attribute_query": {
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
},
"text_query": {
"keywords": []
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/catalog/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/catalog/search")
.header("content-type", "application/json")
.body("{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}")
.asString();
const data = JSON.stringify({
begin_time: '',
cursor: '',
include_deleted_objects: false,
include_related_objects: false,
limit: 0,
object_types: [],
query: {
exact_query: {
attribute_name: '',
attribute_value: ''
},
item_variations_for_item_option_values_query: {
item_option_value_ids: []
},
items_for_item_options_query: {
item_option_ids: []
},
items_for_modifier_list_query: {
modifier_list_ids: []
},
items_for_tax_query: {
tax_ids: []
},
prefix_query: {
attribute_name: '',
attribute_prefix: ''
},
range_query: {
attribute_max_value: 0,
attribute_min_value: 0,
attribute_name: ''
},
set_query: {
attribute_name: '',
attribute_values: []
},
sorted_attribute_query: {
attribute_name: '',
initial_attribute_value: '',
sort_order: ''
},
text_query: {
keywords: []
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/catalog/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/search',
headers: {'content-type': 'application/json'},
data: {
begin_time: '',
cursor: '',
include_deleted_objects: false,
include_related_objects: false,
limit: 0,
object_types: [],
query: {
exact_query: {attribute_name: '', attribute_value: ''},
item_variations_for_item_option_values_query: {item_option_value_ids: []},
items_for_item_options_query: {item_option_ids: []},
items_for_modifier_list_query: {modifier_list_ids: []},
items_for_tax_query: {tax_ids: []},
prefix_query: {attribute_name: '', attribute_prefix: ''},
range_query: {attribute_max_value: 0, attribute_min_value: 0, attribute_name: ''},
set_query: {attribute_name: '', attribute_values: []},
sorted_attribute_query: {attribute_name: '', initial_attribute_value: '', sort_order: ''},
text_query: {keywords: []}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"begin_time":"","cursor":"","include_deleted_objects":false,"include_related_objects":false,"limit":0,"object_types":[],"query":{"exact_query":{"attribute_name":"","attribute_value":""},"item_variations_for_item_option_values_query":{"item_option_value_ids":[]},"items_for_item_options_query":{"item_option_ids":[]},"items_for_modifier_list_query":{"modifier_list_ids":[]},"items_for_tax_query":{"tax_ids":[]},"prefix_query":{"attribute_name":"","attribute_prefix":""},"range_query":{"attribute_max_value":0,"attribute_min_value":0,"attribute_name":""},"set_query":{"attribute_name":"","attribute_values":[]},"sorted_attribute_query":{"attribute_name":"","initial_attribute_value":"","sort_order":""},"text_query":{"keywords":[]}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "begin_time": "",\n "cursor": "",\n "include_deleted_objects": false,\n "include_related_objects": false,\n "limit": 0,\n "object_types": [],\n "query": {\n "exact_query": {\n "attribute_name": "",\n "attribute_value": ""\n },\n "item_variations_for_item_option_values_query": {\n "item_option_value_ids": []\n },\n "items_for_item_options_query": {\n "item_option_ids": []\n },\n "items_for_modifier_list_query": {\n "modifier_list_ids": []\n },\n "items_for_tax_query": {\n "tax_ids": []\n },\n "prefix_query": {\n "attribute_name": "",\n "attribute_prefix": ""\n },\n "range_query": {\n "attribute_max_value": 0,\n "attribute_min_value": 0,\n "attribute_name": ""\n },\n "set_query": {\n "attribute_name": "",\n "attribute_values": []\n },\n "sorted_attribute_query": {\n "attribute_name": "",\n "initial_attribute_value": "",\n "sort_order": ""\n },\n "text_query": {\n "keywords": []\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
begin_time: '',
cursor: '',
include_deleted_objects: false,
include_related_objects: false,
limit: 0,
object_types: [],
query: {
exact_query: {attribute_name: '', attribute_value: ''},
item_variations_for_item_option_values_query: {item_option_value_ids: []},
items_for_item_options_query: {item_option_ids: []},
items_for_modifier_list_query: {modifier_list_ids: []},
items_for_tax_query: {tax_ids: []},
prefix_query: {attribute_name: '', attribute_prefix: ''},
range_query: {attribute_max_value: 0, attribute_min_value: 0, attribute_name: ''},
set_query: {attribute_name: '', attribute_values: []},
sorted_attribute_query: {attribute_name: '', initial_attribute_value: '', sort_order: ''},
text_query: {keywords: []}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/search',
headers: {'content-type': 'application/json'},
body: {
begin_time: '',
cursor: '',
include_deleted_objects: false,
include_related_objects: false,
limit: 0,
object_types: [],
query: {
exact_query: {attribute_name: '', attribute_value: ''},
item_variations_for_item_option_values_query: {item_option_value_ids: []},
items_for_item_options_query: {item_option_ids: []},
items_for_modifier_list_query: {modifier_list_ids: []},
items_for_tax_query: {tax_ids: []},
prefix_query: {attribute_name: '', attribute_prefix: ''},
range_query: {attribute_max_value: 0, attribute_min_value: 0, attribute_name: ''},
set_query: {attribute_name: '', attribute_values: []},
sorted_attribute_query: {attribute_name: '', initial_attribute_value: '', sort_order: ''},
text_query: {keywords: []}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/catalog/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
begin_time: '',
cursor: '',
include_deleted_objects: false,
include_related_objects: false,
limit: 0,
object_types: [],
query: {
exact_query: {
attribute_name: '',
attribute_value: ''
},
item_variations_for_item_option_values_query: {
item_option_value_ids: []
},
items_for_item_options_query: {
item_option_ids: []
},
items_for_modifier_list_query: {
modifier_list_ids: []
},
items_for_tax_query: {
tax_ids: []
},
prefix_query: {
attribute_name: '',
attribute_prefix: ''
},
range_query: {
attribute_max_value: 0,
attribute_min_value: 0,
attribute_name: ''
},
set_query: {
attribute_name: '',
attribute_values: []
},
sorted_attribute_query: {
attribute_name: '',
initial_attribute_value: '',
sort_order: ''
},
text_query: {
keywords: []
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/search',
headers: {'content-type': 'application/json'},
data: {
begin_time: '',
cursor: '',
include_deleted_objects: false,
include_related_objects: false,
limit: 0,
object_types: [],
query: {
exact_query: {attribute_name: '', attribute_value: ''},
item_variations_for_item_option_values_query: {item_option_value_ids: []},
items_for_item_options_query: {item_option_ids: []},
items_for_modifier_list_query: {modifier_list_ids: []},
items_for_tax_query: {tax_ids: []},
prefix_query: {attribute_name: '', attribute_prefix: ''},
range_query: {attribute_max_value: 0, attribute_min_value: 0, attribute_name: ''},
set_query: {attribute_name: '', attribute_values: []},
sorted_attribute_query: {attribute_name: '', initial_attribute_value: '', sort_order: ''},
text_query: {keywords: []}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"begin_time":"","cursor":"","include_deleted_objects":false,"include_related_objects":false,"limit":0,"object_types":[],"query":{"exact_query":{"attribute_name":"","attribute_value":""},"item_variations_for_item_option_values_query":{"item_option_value_ids":[]},"items_for_item_options_query":{"item_option_ids":[]},"items_for_modifier_list_query":{"modifier_list_ids":[]},"items_for_tax_query":{"tax_ids":[]},"prefix_query":{"attribute_name":"","attribute_prefix":""},"range_query":{"attribute_max_value":0,"attribute_min_value":0,"attribute_name":""},"set_query":{"attribute_name":"","attribute_values":[]},"sorted_attribute_query":{"attribute_name":"","initial_attribute_value":"","sort_order":""},"text_query":{"keywords":[]}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"begin_time": @"",
@"cursor": @"",
@"include_deleted_objects": @NO,
@"include_related_objects": @NO,
@"limit": @0,
@"object_types": @[ ],
@"query": @{ @"exact_query": @{ @"attribute_name": @"", @"attribute_value": @"" }, @"item_variations_for_item_option_values_query": @{ @"item_option_value_ids": @[ ] }, @"items_for_item_options_query": @{ @"item_option_ids": @[ ] }, @"items_for_modifier_list_query": @{ @"modifier_list_ids": @[ ] }, @"items_for_tax_query": @{ @"tax_ids": @[ ] }, @"prefix_query": @{ @"attribute_name": @"", @"attribute_prefix": @"" }, @"range_query": @{ @"attribute_max_value": @0, @"attribute_min_value": @0, @"attribute_name": @"" }, @"set_query": @{ @"attribute_name": @"", @"attribute_values": @[ ] }, @"sorted_attribute_query": @{ @"attribute_name": @"", @"initial_attribute_value": @"", @"sort_order": @"" }, @"text_query": @{ @"keywords": @[ ] } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'begin_time' => '',
'cursor' => '',
'include_deleted_objects' => null,
'include_related_objects' => null,
'limit' => 0,
'object_types' => [
],
'query' => [
'exact_query' => [
'attribute_name' => '',
'attribute_value' => ''
],
'item_variations_for_item_option_values_query' => [
'item_option_value_ids' => [
]
],
'items_for_item_options_query' => [
'item_option_ids' => [
]
],
'items_for_modifier_list_query' => [
'modifier_list_ids' => [
]
],
'items_for_tax_query' => [
'tax_ids' => [
]
],
'prefix_query' => [
'attribute_name' => '',
'attribute_prefix' => ''
],
'range_query' => [
'attribute_max_value' => 0,
'attribute_min_value' => 0,
'attribute_name' => ''
],
'set_query' => [
'attribute_name' => '',
'attribute_values' => [
]
],
'sorted_attribute_query' => [
'attribute_name' => '',
'initial_attribute_value' => '',
'sort_order' => ''
],
'text_query' => [
'keywords' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/catalog/search', [
'body' => '{
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": [],
"query": {
"exact_query": {
"attribute_name": "",
"attribute_value": ""
},
"item_variations_for_item_option_values_query": {
"item_option_value_ids": []
},
"items_for_item_options_query": {
"item_option_ids": []
},
"items_for_modifier_list_query": {
"modifier_list_ids": []
},
"items_for_tax_query": {
"tax_ids": []
},
"prefix_query": {
"attribute_name": "",
"attribute_prefix": ""
},
"range_query": {
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
},
"set_query": {
"attribute_name": "",
"attribute_values": []
},
"sorted_attribute_query": {
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
},
"text_query": {
"keywords": []
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'begin_time' => '',
'cursor' => '',
'include_deleted_objects' => null,
'include_related_objects' => null,
'limit' => 0,
'object_types' => [
],
'query' => [
'exact_query' => [
'attribute_name' => '',
'attribute_value' => ''
],
'item_variations_for_item_option_values_query' => [
'item_option_value_ids' => [
]
],
'items_for_item_options_query' => [
'item_option_ids' => [
]
],
'items_for_modifier_list_query' => [
'modifier_list_ids' => [
]
],
'items_for_tax_query' => [
'tax_ids' => [
]
],
'prefix_query' => [
'attribute_name' => '',
'attribute_prefix' => ''
],
'range_query' => [
'attribute_max_value' => 0,
'attribute_min_value' => 0,
'attribute_name' => ''
],
'set_query' => [
'attribute_name' => '',
'attribute_values' => [
]
],
'sorted_attribute_query' => [
'attribute_name' => '',
'initial_attribute_value' => '',
'sort_order' => ''
],
'text_query' => [
'keywords' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'begin_time' => '',
'cursor' => '',
'include_deleted_objects' => null,
'include_related_objects' => null,
'limit' => 0,
'object_types' => [
],
'query' => [
'exact_query' => [
'attribute_name' => '',
'attribute_value' => ''
],
'item_variations_for_item_option_values_query' => [
'item_option_value_ids' => [
]
],
'items_for_item_options_query' => [
'item_option_ids' => [
]
],
'items_for_modifier_list_query' => [
'modifier_list_ids' => [
]
],
'items_for_tax_query' => [
'tax_ids' => [
]
],
'prefix_query' => [
'attribute_name' => '',
'attribute_prefix' => ''
],
'range_query' => [
'attribute_max_value' => 0,
'attribute_min_value' => 0,
'attribute_name' => ''
],
'set_query' => [
'attribute_name' => '',
'attribute_values' => [
]
],
'sorted_attribute_query' => [
'attribute_name' => '',
'initial_attribute_value' => '',
'sort_order' => ''
],
'text_query' => [
'keywords' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/catalog/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": [],
"query": {
"exact_query": {
"attribute_name": "",
"attribute_value": ""
},
"item_variations_for_item_option_values_query": {
"item_option_value_ids": []
},
"items_for_item_options_query": {
"item_option_ids": []
},
"items_for_modifier_list_query": {
"modifier_list_ids": []
},
"items_for_tax_query": {
"tax_ids": []
},
"prefix_query": {
"attribute_name": "",
"attribute_prefix": ""
},
"range_query": {
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
},
"set_query": {
"attribute_name": "",
"attribute_values": []
},
"sorted_attribute_query": {
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
},
"text_query": {
"keywords": []
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": [],
"query": {
"exact_query": {
"attribute_name": "",
"attribute_value": ""
},
"item_variations_for_item_option_values_query": {
"item_option_value_ids": []
},
"items_for_item_options_query": {
"item_option_ids": []
},
"items_for_modifier_list_query": {
"modifier_list_ids": []
},
"items_for_tax_query": {
"tax_ids": []
},
"prefix_query": {
"attribute_name": "",
"attribute_prefix": ""
},
"range_query": {
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
},
"set_query": {
"attribute_name": "",
"attribute_values": []
},
"sorted_attribute_query": {
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
},
"text_query": {
"keywords": []
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/catalog/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/search"
payload = {
"begin_time": "",
"cursor": "",
"include_deleted_objects": False,
"include_related_objects": False,
"limit": 0,
"object_types": [],
"query": {
"exact_query": {
"attribute_name": "",
"attribute_value": ""
},
"item_variations_for_item_option_values_query": { "item_option_value_ids": [] },
"items_for_item_options_query": { "item_option_ids": [] },
"items_for_modifier_list_query": { "modifier_list_ids": [] },
"items_for_tax_query": { "tax_ids": [] },
"prefix_query": {
"attribute_name": "",
"attribute_prefix": ""
},
"range_query": {
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
},
"set_query": {
"attribute_name": "",
"attribute_values": []
},
"sorted_attribute_query": {
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
},
"text_query": { "keywords": [] }
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/search"
payload <- "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/catalog/search') do |req|
req.body = "{\n \"begin_time\": \"\",\n \"cursor\": \"\",\n \"include_deleted_objects\": false,\n \"include_related_objects\": false,\n \"limit\": 0,\n \"object_types\": [],\n \"query\": {\n \"exact_query\": {\n \"attribute_name\": \"\",\n \"attribute_value\": \"\"\n },\n \"item_variations_for_item_option_values_query\": {\n \"item_option_value_ids\": []\n },\n \"items_for_item_options_query\": {\n \"item_option_ids\": []\n },\n \"items_for_modifier_list_query\": {\n \"modifier_list_ids\": []\n },\n \"items_for_tax_query\": {\n \"tax_ids\": []\n },\n \"prefix_query\": {\n \"attribute_name\": \"\",\n \"attribute_prefix\": \"\"\n },\n \"range_query\": {\n \"attribute_max_value\": 0,\n \"attribute_min_value\": 0,\n \"attribute_name\": \"\"\n },\n \"set_query\": {\n \"attribute_name\": \"\",\n \"attribute_values\": []\n },\n \"sorted_attribute_query\": {\n \"attribute_name\": \"\",\n \"initial_attribute_value\": \"\",\n \"sort_order\": \"\"\n },\n \"text_query\": {\n \"keywords\": []\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/search";
let payload = json!({
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": (),
"query": json!({
"exact_query": json!({
"attribute_name": "",
"attribute_value": ""
}),
"item_variations_for_item_option_values_query": json!({"item_option_value_ids": ()}),
"items_for_item_options_query": json!({"item_option_ids": ()}),
"items_for_modifier_list_query": json!({"modifier_list_ids": ()}),
"items_for_tax_query": json!({"tax_ids": ()}),
"prefix_query": json!({
"attribute_name": "",
"attribute_prefix": ""
}),
"range_query": json!({
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
}),
"set_query": json!({
"attribute_name": "",
"attribute_values": ()
}),
"sorted_attribute_query": json!({
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
}),
"text_query": json!({"keywords": ()})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/catalog/search \
--header 'content-type: application/json' \
--data '{
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": [],
"query": {
"exact_query": {
"attribute_name": "",
"attribute_value": ""
},
"item_variations_for_item_option_values_query": {
"item_option_value_ids": []
},
"items_for_item_options_query": {
"item_option_ids": []
},
"items_for_modifier_list_query": {
"modifier_list_ids": []
},
"items_for_tax_query": {
"tax_ids": []
},
"prefix_query": {
"attribute_name": "",
"attribute_prefix": ""
},
"range_query": {
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
},
"set_query": {
"attribute_name": "",
"attribute_values": []
},
"sorted_attribute_query": {
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
},
"text_query": {
"keywords": []
}
}
}'
echo '{
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": [],
"query": {
"exact_query": {
"attribute_name": "",
"attribute_value": ""
},
"item_variations_for_item_option_values_query": {
"item_option_value_ids": []
},
"items_for_item_options_query": {
"item_option_ids": []
},
"items_for_modifier_list_query": {
"modifier_list_ids": []
},
"items_for_tax_query": {
"tax_ids": []
},
"prefix_query": {
"attribute_name": "",
"attribute_prefix": ""
},
"range_query": {
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
},
"set_query": {
"attribute_name": "",
"attribute_values": []
},
"sorted_attribute_query": {
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
},
"text_query": {
"keywords": []
}
}
}' | \
http POST {{baseUrl}}/v2/catalog/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "begin_time": "",\n "cursor": "",\n "include_deleted_objects": false,\n "include_related_objects": false,\n "limit": 0,\n "object_types": [],\n "query": {\n "exact_query": {\n "attribute_name": "",\n "attribute_value": ""\n },\n "item_variations_for_item_option_values_query": {\n "item_option_value_ids": []\n },\n "items_for_item_options_query": {\n "item_option_ids": []\n },\n "items_for_modifier_list_query": {\n "modifier_list_ids": []\n },\n "items_for_tax_query": {\n "tax_ids": []\n },\n "prefix_query": {\n "attribute_name": "",\n "attribute_prefix": ""\n },\n "range_query": {\n "attribute_max_value": 0,\n "attribute_min_value": 0,\n "attribute_name": ""\n },\n "set_query": {\n "attribute_name": "",\n "attribute_values": []\n },\n "sorted_attribute_query": {\n "attribute_name": "",\n "initial_attribute_value": "",\n "sort_order": ""\n },\n "text_query": {\n "keywords": []\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/catalog/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"begin_time": "",
"cursor": "",
"include_deleted_objects": false,
"include_related_objects": false,
"limit": 0,
"object_types": [],
"query": [
"exact_query": [
"attribute_name": "",
"attribute_value": ""
],
"item_variations_for_item_option_values_query": ["item_option_value_ids": []],
"items_for_item_options_query": ["item_option_ids": []],
"items_for_modifier_list_query": ["modifier_list_ids": []],
"items_for_tax_query": ["tax_ids": []],
"prefix_query": [
"attribute_name": "",
"attribute_prefix": ""
],
"range_query": [
"attribute_max_value": 0,
"attribute_min_value": 0,
"attribute_name": ""
],
"set_query": [
"attribute_name": "",
"attribute_values": []
],
"sorted_attribute_query": [
"attribute_name": "",
"initial_attribute_value": "",
"sort_order": ""
],
"text_query": ["keywords": []]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"objects": [
{
"id": "X5DZ5NWWAQ44CKBLKIFQGOWK",
"is_deleted": false,
"item_data": {
"category_id": "E7CLE5RZZ744BHWVQQEAHI2C",
"description": "A delicious blend of black tea.",
"name": "Tea - Black",
"product_type": "REGULAR",
"tax_ids": [
"ZXITPM6RWHZ7GZ7EIP3YKECM"
],
"variations": [
{
"id": "5GSZPX6EU7MM75S57OONG3V5",
"is_deleted": false,
"item_variation_data": {
"item_id": "X5DZ5NWWAQ44CKBLKIFQGOWK",
"name": "Regular",
"ordinal": 1,
"price_money": {
"amount": 150,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2017-10-26T15:27:31.626Z",
"version": 1509031651626
},
{
"id": "XVLBN7DU6JTWHJTG5F265B43",
"is_deleted": false,
"item_variation_data": {
"item_id": "X5DZ5NWWAQ44CKBLKIFQGOWK",
"name": "Large",
"ordinal": 2,
"price_money": {
"amount": 225,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2017-10-26T15:27:31.626Z",
"version": 1509031651626
}
],
"visibility": "PRIVATE"
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2017-10-26T15:41:32.337Z",
"version": 1509032492337
},
{
"id": "NNNEM3LA656Q46NXLWCNI7S5",
"is_deleted": false,
"item_data": {
"category_id": "E7CLE5RZZ744BHWVQQEAHI2C",
"description": "Relaxing green herbal tea.",
"name": "Tea - Green",
"product_type": "REGULAR",
"tax_ids": [
"ZXITPM6RWHZ7GZ7EIP3YKECM"
],
"variations": [
{
"id": "FHYBVIA6NVBCSOVETA62WEA4",
"is_deleted": false,
"item_variation_data": {
"item_id": "NNNEM3LA656Q46NXLWCNI7S5",
"name": "Regular",
"ordinal": 1,
"price_money": {
"amount": 150,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING"
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2017-10-26T15:29:00.524Z",
"version": 1509031740524
}
],
"visibility": "PRIVATE"
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2017-10-26T15:41:23.232Z",
"version": 1509032483232
}
]
}
POST
UpdateItemModifierLists
{{baseUrl}}/v2/catalog/update-item-modifier-lists
BODY json
{
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/update-item-modifier-lists");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/catalog/update-item-modifier-lists" {:content-type :json
:form-params {:item_ids []
:modifier_lists_to_disable []
:modifier_lists_to_enable []}})
require "http/client"
url = "{{baseUrl}}/v2/catalog/update-item-modifier-lists"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/update-item-modifier-lists"),
Content = new StringContent("{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/update-item-modifier-lists");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/update-item-modifier-lists"
payload := strings.NewReader("{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/catalog/update-item-modifier-lists HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 89
{
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/catalog/update-item-modifier-lists")
.setHeader("content-type", "application/json")
.setBody("{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/update-item-modifier-lists"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/update-item-modifier-lists")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/catalog/update-item-modifier-lists")
.header("content-type", "application/json")
.body("{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}")
.asString();
const data = JSON.stringify({
item_ids: [],
modifier_lists_to_disable: [],
modifier_lists_to_enable: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/catalog/update-item-modifier-lists');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/update-item-modifier-lists',
headers: {'content-type': 'application/json'},
data: {item_ids: [], modifier_lists_to_disable: [], modifier_lists_to_enable: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/update-item-modifier-lists';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"item_ids":[],"modifier_lists_to_disable":[],"modifier_lists_to_enable":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/update-item-modifier-lists',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "item_ids": [],\n "modifier_lists_to_disable": [],\n "modifier_lists_to_enable": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/update-item-modifier-lists")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/update-item-modifier-lists',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({item_ids: [], modifier_lists_to_disable: [], modifier_lists_to_enable: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/update-item-modifier-lists',
headers: {'content-type': 'application/json'},
body: {item_ids: [], modifier_lists_to_disable: [], modifier_lists_to_enable: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/catalog/update-item-modifier-lists');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
item_ids: [],
modifier_lists_to_disable: [],
modifier_lists_to_enable: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/update-item-modifier-lists',
headers: {'content-type': 'application/json'},
data: {item_ids: [], modifier_lists_to_disable: [], modifier_lists_to_enable: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/update-item-modifier-lists';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"item_ids":[],"modifier_lists_to_disable":[],"modifier_lists_to_enable":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"item_ids": @[ ],
@"modifier_lists_to_disable": @[ ],
@"modifier_lists_to_enable": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/update-item-modifier-lists"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/update-item-modifier-lists" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/update-item-modifier-lists",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'item_ids' => [
],
'modifier_lists_to_disable' => [
],
'modifier_lists_to_enable' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/catalog/update-item-modifier-lists', [
'body' => '{
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/update-item-modifier-lists');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'item_ids' => [
],
'modifier_lists_to_disable' => [
],
'modifier_lists_to_enable' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'item_ids' => [
],
'modifier_lists_to_disable' => [
],
'modifier_lists_to_enable' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/catalog/update-item-modifier-lists');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/update-item-modifier-lists' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/update-item-modifier-lists' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/catalog/update-item-modifier-lists", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/update-item-modifier-lists"
payload = {
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/update-item-modifier-lists"
payload <- "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/update-item-modifier-lists")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/catalog/update-item-modifier-lists') do |req|
req.body = "{\n \"item_ids\": [],\n \"modifier_lists_to_disable\": [],\n \"modifier_lists_to_enable\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/update-item-modifier-lists";
let payload = json!({
"item_ids": (),
"modifier_lists_to_disable": (),
"modifier_lists_to_enable": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/catalog/update-item-modifier-lists \
--header 'content-type: application/json' \
--data '{
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
}'
echo '{
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
}' | \
http POST {{baseUrl}}/v2/catalog/update-item-modifier-lists \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "item_ids": [],\n "modifier_lists_to_disable": [],\n "modifier_lists_to_enable": []\n}' \
--output-document \
- {{baseUrl}}/v2/catalog/update-item-modifier-lists
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"item_ids": [],
"modifier_lists_to_disable": [],
"modifier_lists_to_enable": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/update-item-modifier-lists")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"updated_at": "2016-11-16T22:25:24.878Z"
}
POST
UpdateItemTaxes
{{baseUrl}}/v2/catalog/update-item-taxes
BODY json
{
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/update-item-taxes");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/catalog/update-item-taxes" {:content-type :json
:form-params {:item_ids []
:taxes_to_disable []
:taxes_to_enable []}})
require "http/client"
url = "{{baseUrl}}/v2/catalog/update-item-taxes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/update-item-taxes"),
Content = new StringContent("{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/update-item-taxes");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/update-item-taxes"
payload := strings.NewReader("{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/catalog/update-item-taxes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 71
{
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/catalog/update-item-taxes")
.setHeader("content-type", "application/json")
.setBody("{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/update-item-taxes"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/update-item-taxes")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/catalog/update-item-taxes")
.header("content-type", "application/json")
.body("{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}")
.asString();
const data = JSON.stringify({
item_ids: [],
taxes_to_disable: [],
taxes_to_enable: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/catalog/update-item-taxes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/update-item-taxes',
headers: {'content-type': 'application/json'},
data: {item_ids: [], taxes_to_disable: [], taxes_to_enable: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/update-item-taxes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"item_ids":[],"taxes_to_disable":[],"taxes_to_enable":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/update-item-taxes',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "item_ids": [],\n "taxes_to_disable": [],\n "taxes_to_enable": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/update-item-taxes")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/update-item-taxes',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({item_ids: [], taxes_to_disable: [], taxes_to_enable: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/update-item-taxes',
headers: {'content-type': 'application/json'},
body: {item_ids: [], taxes_to_disable: [], taxes_to_enable: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/catalog/update-item-taxes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
item_ids: [],
taxes_to_disable: [],
taxes_to_enable: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/update-item-taxes',
headers: {'content-type': 'application/json'},
data: {item_ids: [], taxes_to_disable: [], taxes_to_enable: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/update-item-taxes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"item_ids":[],"taxes_to_disable":[],"taxes_to_enable":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"item_ids": @[ ],
@"taxes_to_disable": @[ ],
@"taxes_to_enable": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/update-item-taxes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/update-item-taxes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/update-item-taxes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'item_ids' => [
],
'taxes_to_disable' => [
],
'taxes_to_enable' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/catalog/update-item-taxes', [
'body' => '{
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/update-item-taxes');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'item_ids' => [
],
'taxes_to_disable' => [
],
'taxes_to_enable' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'item_ids' => [
],
'taxes_to_disable' => [
],
'taxes_to_enable' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/catalog/update-item-taxes');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/update-item-taxes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/update-item-taxes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/catalog/update-item-taxes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/update-item-taxes"
payload = {
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/update-item-taxes"
payload <- "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/update-item-taxes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/catalog/update-item-taxes') do |req|
req.body = "{\n \"item_ids\": [],\n \"taxes_to_disable\": [],\n \"taxes_to_enable\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/update-item-taxes";
let payload = json!({
"item_ids": (),
"taxes_to_disable": (),
"taxes_to_enable": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/catalog/update-item-taxes \
--header 'content-type: application/json' \
--data '{
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
}'
echo '{
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
}' | \
http POST {{baseUrl}}/v2/catalog/update-item-taxes \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "item_ids": [],\n "taxes_to_disable": [],\n "taxes_to_enable": []\n}' \
--output-document \
- {{baseUrl}}/v2/catalog/update-item-taxes
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"item_ids": [],
"taxes_to_disable": [],
"taxes_to_enable": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/update-item-taxes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"updated_at": "2016-11-16T22:25:24.878Z"
}
POST
UpsertCatalogObject
{{baseUrl}}/v2/catalog/object
BODY json
{
"idempotency_key": "",
"object": {
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/catalog/object");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/catalog/object" {:content-type :json
:form-params {:idempotency_key ""
:object {:absent_at_location_ids []
:catalog_v1_ids [{:catalog_v1_id ""
:location_id ""}]
:category_data {:name ""}
:custom_attribute_definition_data {:allowed_object_types []
:app_visibility ""
:custom_attribute_usage_count 0
:description ""
:key ""
:name ""
:number_config {:precision 0}
:selection_config {:allowed_selections [{:name ""
:uid ""}]
:max_allowed_selections 0}
:seller_visibility ""
:source_application {:application_id ""
:name ""
:product ""}
:string_config {:enforce_uniqueness false}
:type ""}
:custom_attribute_values {}
:discount_data {:amount_money {:amount 0
:currency ""}
:discount_type ""
:label_color ""
:modify_tax_basis ""
:name ""
:percentage ""
:pin_required false}
:id ""
:image_data {:caption ""
:name ""
:url ""}
:image_id ""
:is_deleted false
:item_data {:abbreviation ""
:available_electronically false
:available_for_pickup false
:available_online false
:category_id ""
:description ""
:item_options [{:item_option_id ""}]
:label_color ""
:modifier_list_info [{:enabled false
:max_selected_modifiers 0
:min_selected_modifiers 0
:modifier_list_id ""
:modifier_overrides [{:modifier_id ""
:on_by_default false}]}]
:name ""
:product_type ""
:skip_modifier_screen false
:sort_name ""
:tax_ids []
:variations []}
:item_option_data {:description ""
:display_name ""
:name ""
:show_colors false
:values []}
:item_option_value_data {:color ""
:description ""
:item_option_id ""
:name ""
:ordinal 0}
:item_variation_data {:available_for_booking false
:inventory_alert_threshold 0
:inventory_alert_type ""
:item_id ""
:item_option_values [{:item_option_id ""
:item_option_value_id ""}]
:location_overrides [{:inventory_alert_threshold 0
:inventory_alert_type ""
:location_id ""
:price_money {}
:pricing_type ""
:track_inventory false}]
:measurement_unit_id ""
:name ""
:ordinal 0
:price_money {}
:pricing_type ""
:service_duration 0
:sku ""
:stockable false
:stockable_conversion {:nonstockable_quantity ""
:stockable_item_variation_id ""
:stockable_quantity ""}
:team_member_ids []
:track_inventory false
:upc ""
:user_data ""}
:measurement_unit_data {:measurement_unit {:area_unit ""
:custom_unit {:abbreviation ""
:name ""}
:generic_unit ""
:length_unit ""
:time_unit ""
:type ""
:volume_unit ""
:weight_unit ""}
:precision 0}
:modifier_data {:modifier_list_id ""
:name ""
:ordinal 0
:price_money {}}
:modifier_list_data {:modifiers []
:name ""
:ordinal 0
:selection_type ""}
:present_at_all_locations false
:present_at_location_ids []
:pricing_rule_data {:apply_products_id ""
:customer_group_ids_any []
:discount_id ""
:exclude_products_id ""
:exclude_strategy ""
:match_products_id ""
:name ""
:time_period_ids []
:valid_from_date ""
:valid_from_local_time ""
:valid_until_date ""
:valid_until_local_time ""}
:product_set_data {:all_products false
:name ""
:product_ids_all []
:product_ids_any []
:quantity_exact 0
:quantity_max 0
:quantity_min 0}
:quick_amounts_settings_data {:amounts [{:amount {}
:ordinal 0
:score 0
:type ""}]
:eligible_for_auto_amounts false
:option ""}
:subscription_plan_data {:name ""
:phases [{:cadence ""
:ordinal 0
:periods 0
:recurring_price_money {}
:uid ""}]}
:tax_data {:applies_to_custom_amounts false
:calculation_phase ""
:enabled false
:inclusion_type ""
:name ""
:percentage ""}
:time_period_data {:event ""}
:type ""
:updated_at ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/catalog/object"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/catalog/object"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/catalog/object");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/catalog/object"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/catalog/object HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 5529
{
"idempotency_key": "",
"object": {
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/catalog/object")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/catalog/object"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/catalog/object")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/catalog/object")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
object: {
absent_at_location_ids: [],
catalog_v1_ids: [
{
catalog_v1_id: '',
location_id: ''
}
],
category_data: {
name: ''
},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {
precision: 0
},
selection_config: {
allowed_selections: [
{
name: '',
uid: ''
}
],
max_allowed_selections: 0
},
seller_visibility: '',
source_application: {
application_id: '',
name: '',
product: ''
},
string_config: {
enforce_uniqueness: false
},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {
amount: 0,
currency: ''
},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {
caption: '',
name: '',
url: ''
},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [
{
item_option_id: ''
}
],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [
{
modifier_id: '',
on_by_default: false
}
]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {
description: '',
display_name: '',
name: '',
show_colors: false,
values: []
},
item_option_value_data: {
color: '',
description: '',
item_option_id: '',
name: '',
ordinal: 0
},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [
{
item_option_id: '',
item_option_value_id: ''
}
],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {
modifier_list_id: '',
name: '',
ordinal: 0,
price_money: {}
},
modifier_list_data: {
modifiers: [],
name: '',
ordinal: 0,
selection_type: ''
},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [
{
amount: {},
ordinal: 0,
score: 0,
type: ''
}
],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [
{
cadence: '',
ordinal: 0,
periods: 0,
recurring_price_money: {},
uid: ''
}
]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {
event: ''
},
type: '',
updated_at: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/catalog/object');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/object',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
object: {
absent_at_location_ids: [],
catalog_v1_ids: [{catalog_v1_id: '', location_id: ''}],
category_data: {name: ''},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {precision: 0},
selection_config: {allowed_selections: [{name: '', uid: ''}], max_allowed_selections: 0},
seller_visibility: '',
source_application: {application_id: '', name: '', product: ''},
string_config: {enforce_uniqueness: false},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {amount: 0, currency: ''},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {caption: '', name: '', url: ''},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [{item_option_id: ''}],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [{modifier_id: '', on_by_default: false}]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {description: '', display_name: '', name: '', show_colors: false, values: []},
item_option_value_data: {color: '', description: '', item_option_id: '', name: '', ordinal: 0},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [{item_option_id: '', item_option_value_id: ''}],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {modifier_list_id: '', name: '', ordinal: 0, price_money: {}},
modifier_list_data: {modifiers: [], name: '', ordinal: 0, selection_type: ''},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [{amount: {}, ordinal: 0, score: 0, type: ''}],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [{cadence: '', ordinal: 0, periods: 0, recurring_price_money: {}, uid: ''}]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {event: ''},
type: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/catalog/object';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","object":{"absent_at_location_ids":[],"catalog_v1_ids":[{"catalog_v1_id":"","location_id":""}],"category_data":{"name":""},"custom_attribute_definition_data":{"allowed_object_types":[],"app_visibility":"","custom_attribute_usage_count":0,"description":"","key":"","name":"","number_config":{"precision":0},"selection_config":{"allowed_selections":[{"name":"","uid":""}],"max_allowed_selections":0},"seller_visibility":"","source_application":{"application_id":"","name":"","product":""},"string_config":{"enforce_uniqueness":false},"type":""},"custom_attribute_values":{},"discount_data":{"amount_money":{"amount":0,"currency":""},"discount_type":"","label_color":"","modify_tax_basis":"","name":"","percentage":"","pin_required":false},"id":"","image_data":{"caption":"","name":"","url":""},"image_id":"","is_deleted":false,"item_data":{"abbreviation":"","available_electronically":false,"available_for_pickup":false,"available_online":false,"category_id":"","description":"","item_options":[{"item_option_id":""}],"label_color":"","modifier_list_info":[{"enabled":false,"max_selected_modifiers":0,"min_selected_modifiers":0,"modifier_list_id":"","modifier_overrides":[{"modifier_id":"","on_by_default":false}]}],"name":"","product_type":"","skip_modifier_screen":false,"sort_name":"","tax_ids":[],"variations":[]},"item_option_data":{"description":"","display_name":"","name":"","show_colors":false,"values":[]},"item_option_value_data":{"color":"","description":"","item_option_id":"","name":"","ordinal":0},"item_variation_data":{"available_for_booking":false,"inventory_alert_threshold":0,"inventory_alert_type":"","item_id":"","item_option_values":[{"item_option_id":"","item_option_value_id":""}],"location_overrides":[{"inventory_alert_threshold":0,"inventory_alert_type":"","location_id":"","price_money":{},"pricing_type":"","track_inventory":false}],"measurement_unit_id":"","name":"","ordinal":0,"price_money":{},"pricing_type":"","service_duration":0,"sku":"","stockable":false,"stockable_conversion":{"nonstockable_quantity":"","stockable_item_variation_id":"","stockable_quantity":""},"team_member_ids":[],"track_inventory":false,"upc":"","user_data":""},"measurement_unit_data":{"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"modifier_data":{"modifier_list_id":"","name":"","ordinal":0,"price_money":{}},"modifier_list_data":{"modifiers":[],"name":"","ordinal":0,"selection_type":""},"present_at_all_locations":false,"present_at_location_ids":[],"pricing_rule_data":{"apply_products_id":"","customer_group_ids_any":[],"discount_id":"","exclude_products_id":"","exclude_strategy":"","match_products_id":"","name":"","time_period_ids":[],"valid_from_date":"","valid_from_local_time":"","valid_until_date":"","valid_until_local_time":""},"product_set_data":{"all_products":false,"name":"","product_ids_all":[],"product_ids_any":[],"quantity_exact":0,"quantity_max":0,"quantity_min":0},"quick_amounts_settings_data":{"amounts":[{"amount":{},"ordinal":0,"score":0,"type":""}],"eligible_for_auto_amounts":false,"option":""},"subscription_plan_data":{"name":"","phases":[{"cadence":"","ordinal":0,"periods":0,"recurring_price_money":{},"uid":""}]},"tax_data":{"applies_to_custom_amounts":false,"calculation_phase":"","enabled":false,"inclusion_type":"","name":"","percentage":""},"time_period_data":{"event":""},"type":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/catalog/object',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "object": {\n "absent_at_location_ids": [],\n "catalog_v1_ids": [\n {\n "catalog_v1_id": "",\n "location_id": ""\n }\n ],\n "category_data": {\n "name": ""\n },\n "custom_attribute_definition_data": {\n "allowed_object_types": [],\n "app_visibility": "",\n "custom_attribute_usage_count": 0,\n "description": "",\n "key": "",\n "name": "",\n "number_config": {\n "precision": 0\n },\n "selection_config": {\n "allowed_selections": [\n {\n "name": "",\n "uid": ""\n }\n ],\n "max_allowed_selections": 0\n },\n "seller_visibility": "",\n "source_application": {\n "application_id": "",\n "name": "",\n "product": ""\n },\n "string_config": {\n "enforce_uniqueness": false\n },\n "type": ""\n },\n "custom_attribute_values": {},\n "discount_data": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "discount_type": "",\n "label_color": "",\n "modify_tax_basis": "",\n "name": "",\n "percentage": "",\n "pin_required": false\n },\n "id": "",\n "image_data": {\n "caption": "",\n "name": "",\n "url": ""\n },\n "image_id": "",\n "is_deleted": false,\n "item_data": {\n "abbreviation": "",\n "available_electronically": false,\n "available_for_pickup": false,\n "available_online": false,\n "category_id": "",\n "description": "",\n "item_options": [\n {\n "item_option_id": ""\n }\n ],\n "label_color": "",\n "modifier_list_info": [\n {\n "enabled": false,\n "max_selected_modifiers": 0,\n "min_selected_modifiers": 0,\n "modifier_list_id": "",\n "modifier_overrides": [\n {\n "modifier_id": "",\n "on_by_default": false\n }\n ]\n }\n ],\n "name": "",\n "product_type": "",\n "skip_modifier_screen": false,\n "sort_name": "",\n "tax_ids": [],\n "variations": []\n },\n "item_option_data": {\n "description": "",\n "display_name": "",\n "name": "",\n "show_colors": false,\n "values": []\n },\n "item_option_value_data": {\n "color": "",\n "description": "",\n "item_option_id": "",\n "name": "",\n "ordinal": 0\n },\n "item_variation_data": {\n "available_for_booking": false,\n "inventory_alert_threshold": 0,\n "inventory_alert_type": "",\n "item_id": "",\n "item_option_values": [\n {\n "item_option_id": "",\n "item_option_value_id": ""\n }\n ],\n "location_overrides": [\n {\n "inventory_alert_threshold": 0,\n "inventory_alert_type": "",\n "location_id": "",\n "price_money": {},\n "pricing_type": "",\n "track_inventory": false\n }\n ],\n "measurement_unit_id": "",\n "name": "",\n "ordinal": 0,\n "price_money": {},\n "pricing_type": "",\n "service_duration": 0,\n "sku": "",\n "stockable": false,\n "stockable_conversion": {\n "nonstockable_quantity": "",\n "stockable_item_variation_id": "",\n "stockable_quantity": ""\n },\n "team_member_ids": [],\n "track_inventory": false,\n "upc": "",\n "user_data": ""\n },\n "measurement_unit_data": {\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "modifier_data": {\n "modifier_list_id": "",\n "name": "",\n "ordinal": 0,\n "price_money": {}\n },\n "modifier_list_data": {\n "modifiers": [],\n "name": "",\n "ordinal": 0,\n "selection_type": ""\n },\n "present_at_all_locations": false,\n "present_at_location_ids": [],\n "pricing_rule_data": {\n "apply_products_id": "",\n "customer_group_ids_any": [],\n "discount_id": "",\n "exclude_products_id": "",\n "exclude_strategy": "",\n "match_products_id": "",\n "name": "",\n "time_period_ids": [],\n "valid_from_date": "",\n "valid_from_local_time": "",\n "valid_until_date": "",\n "valid_until_local_time": ""\n },\n "product_set_data": {\n "all_products": false,\n "name": "",\n "product_ids_all": [],\n "product_ids_any": [],\n "quantity_exact": 0,\n "quantity_max": 0,\n "quantity_min": 0\n },\n "quick_amounts_settings_data": {\n "amounts": [\n {\n "amount": {},\n "ordinal": 0,\n "score": 0,\n "type": ""\n }\n ],\n "eligible_for_auto_amounts": false,\n "option": ""\n },\n "subscription_plan_data": {\n "name": "",\n "phases": [\n {\n "cadence": "",\n "ordinal": 0,\n "periods": 0,\n "recurring_price_money": {},\n "uid": ""\n }\n ]\n },\n "tax_data": {\n "applies_to_custom_amounts": false,\n "calculation_phase": "",\n "enabled": false,\n "inclusion_type": "",\n "name": "",\n "percentage": ""\n },\n "time_period_data": {\n "event": ""\n },\n "type": "",\n "updated_at": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/catalog/object")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/catalog/object',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
object: {
absent_at_location_ids: [],
catalog_v1_ids: [{catalog_v1_id: '', location_id: ''}],
category_data: {name: ''},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {precision: 0},
selection_config: {allowed_selections: [{name: '', uid: ''}], max_allowed_selections: 0},
seller_visibility: '',
source_application: {application_id: '', name: '', product: ''},
string_config: {enforce_uniqueness: false},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {amount: 0, currency: ''},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {caption: '', name: '', url: ''},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [{item_option_id: ''}],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [{modifier_id: '', on_by_default: false}]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {description: '', display_name: '', name: '', show_colors: false, values: []},
item_option_value_data: {color: '', description: '', item_option_id: '', name: '', ordinal: 0},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [{item_option_id: '', item_option_value_id: ''}],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {modifier_list_id: '', name: '', ordinal: 0, price_money: {}},
modifier_list_data: {modifiers: [], name: '', ordinal: 0, selection_type: ''},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [{amount: {}, ordinal: 0, score: 0, type: ''}],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [{cadence: '', ordinal: 0, periods: 0, recurring_price_money: {}, uid: ''}]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {event: ''},
type: '',
updated_at: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/object',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
object: {
absent_at_location_ids: [],
catalog_v1_ids: [{catalog_v1_id: '', location_id: ''}],
category_data: {name: ''},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {precision: 0},
selection_config: {allowed_selections: [{name: '', uid: ''}], max_allowed_selections: 0},
seller_visibility: '',
source_application: {application_id: '', name: '', product: ''},
string_config: {enforce_uniqueness: false},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {amount: 0, currency: ''},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {caption: '', name: '', url: ''},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [{item_option_id: ''}],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [{modifier_id: '', on_by_default: false}]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {description: '', display_name: '', name: '', show_colors: false, values: []},
item_option_value_data: {color: '', description: '', item_option_id: '', name: '', ordinal: 0},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [{item_option_id: '', item_option_value_id: ''}],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {modifier_list_id: '', name: '', ordinal: 0, price_money: {}},
modifier_list_data: {modifiers: [], name: '', ordinal: 0, selection_type: ''},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [{amount: {}, ordinal: 0, score: 0, type: ''}],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [{cadence: '', ordinal: 0, periods: 0, recurring_price_money: {}, uid: ''}]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {event: ''},
type: '',
updated_at: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/catalog/object');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
object: {
absent_at_location_ids: [],
catalog_v1_ids: [
{
catalog_v1_id: '',
location_id: ''
}
],
category_data: {
name: ''
},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {
precision: 0
},
selection_config: {
allowed_selections: [
{
name: '',
uid: ''
}
],
max_allowed_selections: 0
},
seller_visibility: '',
source_application: {
application_id: '',
name: '',
product: ''
},
string_config: {
enforce_uniqueness: false
},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {
amount: 0,
currency: ''
},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {
caption: '',
name: '',
url: ''
},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [
{
item_option_id: ''
}
],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [
{
modifier_id: '',
on_by_default: false
}
]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {
description: '',
display_name: '',
name: '',
show_colors: false,
values: []
},
item_option_value_data: {
color: '',
description: '',
item_option_id: '',
name: '',
ordinal: 0
},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [
{
item_option_id: '',
item_option_value_id: ''
}
],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {
modifier_list_id: '',
name: '',
ordinal: 0,
price_money: {}
},
modifier_list_data: {
modifiers: [],
name: '',
ordinal: 0,
selection_type: ''
},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [
{
amount: {},
ordinal: 0,
score: 0,
type: ''
}
],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [
{
cadence: '',
ordinal: 0,
periods: 0,
recurring_price_money: {},
uid: ''
}
]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {
event: ''
},
type: '',
updated_at: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/catalog/object',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
object: {
absent_at_location_ids: [],
catalog_v1_ids: [{catalog_v1_id: '', location_id: ''}],
category_data: {name: ''},
custom_attribute_definition_data: {
allowed_object_types: [],
app_visibility: '',
custom_attribute_usage_count: 0,
description: '',
key: '',
name: '',
number_config: {precision: 0},
selection_config: {allowed_selections: [{name: '', uid: ''}], max_allowed_selections: 0},
seller_visibility: '',
source_application: {application_id: '', name: '', product: ''},
string_config: {enforce_uniqueness: false},
type: ''
},
custom_attribute_values: {},
discount_data: {
amount_money: {amount: 0, currency: ''},
discount_type: '',
label_color: '',
modify_tax_basis: '',
name: '',
percentage: '',
pin_required: false
},
id: '',
image_data: {caption: '', name: '', url: ''},
image_id: '',
is_deleted: false,
item_data: {
abbreviation: '',
available_electronically: false,
available_for_pickup: false,
available_online: false,
category_id: '',
description: '',
item_options: [{item_option_id: ''}],
label_color: '',
modifier_list_info: [
{
enabled: false,
max_selected_modifiers: 0,
min_selected_modifiers: 0,
modifier_list_id: '',
modifier_overrides: [{modifier_id: '', on_by_default: false}]
}
],
name: '',
product_type: '',
skip_modifier_screen: false,
sort_name: '',
tax_ids: [],
variations: []
},
item_option_data: {description: '', display_name: '', name: '', show_colors: false, values: []},
item_option_value_data: {color: '', description: '', item_option_id: '', name: '', ordinal: 0},
item_variation_data: {
available_for_booking: false,
inventory_alert_threshold: 0,
inventory_alert_type: '',
item_id: '',
item_option_values: [{item_option_id: '', item_option_value_id: ''}],
location_overrides: [
{
inventory_alert_threshold: 0,
inventory_alert_type: '',
location_id: '',
price_money: {},
pricing_type: '',
track_inventory: false
}
],
measurement_unit_id: '',
name: '',
ordinal: 0,
price_money: {},
pricing_type: '',
service_duration: 0,
sku: '',
stockable: false,
stockable_conversion: {
nonstockable_quantity: '',
stockable_item_variation_id: '',
stockable_quantity: ''
},
team_member_ids: [],
track_inventory: false,
upc: '',
user_data: ''
},
measurement_unit_data: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
modifier_data: {modifier_list_id: '', name: '', ordinal: 0, price_money: {}},
modifier_list_data: {modifiers: [], name: '', ordinal: 0, selection_type: ''},
present_at_all_locations: false,
present_at_location_ids: [],
pricing_rule_data: {
apply_products_id: '',
customer_group_ids_any: [],
discount_id: '',
exclude_products_id: '',
exclude_strategy: '',
match_products_id: '',
name: '',
time_period_ids: [],
valid_from_date: '',
valid_from_local_time: '',
valid_until_date: '',
valid_until_local_time: ''
},
product_set_data: {
all_products: false,
name: '',
product_ids_all: [],
product_ids_any: [],
quantity_exact: 0,
quantity_max: 0,
quantity_min: 0
},
quick_amounts_settings_data: {
amounts: [{amount: {}, ordinal: 0, score: 0, type: ''}],
eligible_for_auto_amounts: false,
option: ''
},
subscription_plan_data: {
name: '',
phases: [{cadence: '', ordinal: 0, periods: 0, recurring_price_money: {}, uid: ''}]
},
tax_data: {
applies_to_custom_amounts: false,
calculation_phase: '',
enabled: false,
inclusion_type: '',
name: '',
percentage: ''
},
time_period_data: {event: ''},
type: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/catalog/object';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","object":{"absent_at_location_ids":[],"catalog_v1_ids":[{"catalog_v1_id":"","location_id":""}],"category_data":{"name":""},"custom_attribute_definition_data":{"allowed_object_types":[],"app_visibility":"","custom_attribute_usage_count":0,"description":"","key":"","name":"","number_config":{"precision":0},"selection_config":{"allowed_selections":[{"name":"","uid":""}],"max_allowed_selections":0},"seller_visibility":"","source_application":{"application_id":"","name":"","product":""},"string_config":{"enforce_uniqueness":false},"type":""},"custom_attribute_values":{},"discount_data":{"amount_money":{"amount":0,"currency":""},"discount_type":"","label_color":"","modify_tax_basis":"","name":"","percentage":"","pin_required":false},"id":"","image_data":{"caption":"","name":"","url":""},"image_id":"","is_deleted":false,"item_data":{"abbreviation":"","available_electronically":false,"available_for_pickup":false,"available_online":false,"category_id":"","description":"","item_options":[{"item_option_id":""}],"label_color":"","modifier_list_info":[{"enabled":false,"max_selected_modifiers":0,"min_selected_modifiers":0,"modifier_list_id":"","modifier_overrides":[{"modifier_id":"","on_by_default":false}]}],"name":"","product_type":"","skip_modifier_screen":false,"sort_name":"","tax_ids":[],"variations":[]},"item_option_data":{"description":"","display_name":"","name":"","show_colors":false,"values":[]},"item_option_value_data":{"color":"","description":"","item_option_id":"","name":"","ordinal":0},"item_variation_data":{"available_for_booking":false,"inventory_alert_threshold":0,"inventory_alert_type":"","item_id":"","item_option_values":[{"item_option_id":"","item_option_value_id":""}],"location_overrides":[{"inventory_alert_threshold":0,"inventory_alert_type":"","location_id":"","price_money":{},"pricing_type":"","track_inventory":false}],"measurement_unit_id":"","name":"","ordinal":0,"price_money":{},"pricing_type":"","service_duration":0,"sku":"","stockable":false,"stockable_conversion":{"nonstockable_quantity":"","stockable_item_variation_id":"","stockable_quantity":""},"team_member_ids":[],"track_inventory":false,"upc":"","user_data":""},"measurement_unit_data":{"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"modifier_data":{"modifier_list_id":"","name":"","ordinal":0,"price_money":{}},"modifier_list_data":{"modifiers":[],"name":"","ordinal":0,"selection_type":""},"present_at_all_locations":false,"present_at_location_ids":[],"pricing_rule_data":{"apply_products_id":"","customer_group_ids_any":[],"discount_id":"","exclude_products_id":"","exclude_strategy":"","match_products_id":"","name":"","time_period_ids":[],"valid_from_date":"","valid_from_local_time":"","valid_until_date":"","valid_until_local_time":""},"product_set_data":{"all_products":false,"name":"","product_ids_all":[],"product_ids_any":[],"quantity_exact":0,"quantity_max":0,"quantity_min":0},"quick_amounts_settings_data":{"amounts":[{"amount":{},"ordinal":0,"score":0,"type":""}],"eligible_for_auto_amounts":false,"option":""},"subscription_plan_data":{"name":"","phases":[{"cadence":"","ordinal":0,"periods":0,"recurring_price_money":{},"uid":""}]},"tax_data":{"applies_to_custom_amounts":false,"calculation_phase":"","enabled":false,"inclusion_type":"","name":"","percentage":""},"time_period_data":{"event":""},"type":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"object": @{ @"absent_at_location_ids": @[ ], @"catalog_v1_ids": @[ @{ @"catalog_v1_id": @"", @"location_id": @"" } ], @"category_data": @{ @"name": @"" }, @"custom_attribute_definition_data": @{ @"allowed_object_types": @[ ], @"app_visibility": @"", @"custom_attribute_usage_count": @0, @"description": @"", @"key": @"", @"name": @"", @"number_config": @{ @"precision": @0 }, @"selection_config": @{ @"allowed_selections": @[ @{ @"name": @"", @"uid": @"" } ], @"max_allowed_selections": @0 }, @"seller_visibility": @"", @"source_application": @{ @"application_id": @"", @"name": @"", @"product": @"" }, @"string_config": @{ @"enforce_uniqueness": @NO }, @"type": @"" }, @"custom_attribute_values": @{ }, @"discount_data": @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"discount_type": @"", @"label_color": @"", @"modify_tax_basis": @"", @"name": @"", @"percentage": @"", @"pin_required": @NO }, @"id": @"", @"image_data": @{ @"caption": @"", @"name": @"", @"url": @"" }, @"image_id": @"", @"is_deleted": @NO, @"item_data": @{ @"abbreviation": @"", @"available_electronically": @NO, @"available_for_pickup": @NO, @"available_online": @NO, @"category_id": @"", @"description": @"", @"item_options": @[ @{ @"item_option_id": @"" } ], @"label_color": @"", @"modifier_list_info": @[ @{ @"enabled": @NO, @"max_selected_modifiers": @0, @"min_selected_modifiers": @0, @"modifier_list_id": @"", @"modifier_overrides": @[ @{ @"modifier_id": @"", @"on_by_default": @NO } ] } ], @"name": @"", @"product_type": @"", @"skip_modifier_screen": @NO, @"sort_name": @"", @"tax_ids": @[ ], @"variations": @[ ] }, @"item_option_data": @{ @"description": @"", @"display_name": @"", @"name": @"", @"show_colors": @NO, @"values": @[ ] }, @"item_option_value_data": @{ @"color": @"", @"description": @"", @"item_option_id": @"", @"name": @"", @"ordinal": @0 }, @"item_variation_data": @{ @"available_for_booking": @NO, @"inventory_alert_threshold": @0, @"inventory_alert_type": @"", @"item_id": @"", @"item_option_values": @[ @{ @"item_option_id": @"", @"item_option_value_id": @"" } ], @"location_overrides": @[ @{ @"inventory_alert_threshold": @0, @"inventory_alert_type": @"", @"location_id": @"", @"price_money": @{ }, @"pricing_type": @"", @"track_inventory": @NO } ], @"measurement_unit_id": @"", @"name": @"", @"ordinal": @0, @"price_money": @{ }, @"pricing_type": @"", @"service_duration": @0, @"sku": @"", @"stockable": @NO, @"stockable_conversion": @{ @"nonstockable_quantity": @"", @"stockable_item_variation_id": @"", @"stockable_quantity": @"" }, @"team_member_ids": @[ ], @"track_inventory": @NO, @"upc": @"", @"user_data": @"" }, @"measurement_unit_data": @{ @"measurement_unit": @{ @"area_unit": @"", @"custom_unit": @{ @"abbreviation": @"", @"name": @"" }, @"generic_unit": @"", @"length_unit": @"", @"time_unit": @"", @"type": @"", @"volume_unit": @"", @"weight_unit": @"" }, @"precision": @0 }, @"modifier_data": @{ @"modifier_list_id": @"", @"name": @"", @"ordinal": @0, @"price_money": @{ } }, @"modifier_list_data": @{ @"modifiers": @[ ], @"name": @"", @"ordinal": @0, @"selection_type": @"" }, @"present_at_all_locations": @NO, @"present_at_location_ids": @[ ], @"pricing_rule_data": @{ @"apply_products_id": @"", @"customer_group_ids_any": @[ ], @"discount_id": @"", @"exclude_products_id": @"", @"exclude_strategy": @"", @"match_products_id": @"", @"name": @"", @"time_period_ids": @[ ], @"valid_from_date": @"", @"valid_from_local_time": @"", @"valid_until_date": @"", @"valid_until_local_time": @"" }, @"product_set_data": @{ @"all_products": @NO, @"name": @"", @"product_ids_all": @[ ], @"product_ids_any": @[ ], @"quantity_exact": @0, @"quantity_max": @0, @"quantity_min": @0 }, @"quick_amounts_settings_data": @{ @"amounts": @[ @{ @"amount": @{ }, @"ordinal": @0, @"score": @0, @"type": @"" } ], @"eligible_for_auto_amounts": @NO, @"option": @"" }, @"subscription_plan_data": @{ @"name": @"", @"phases": @[ @{ @"cadence": @"", @"ordinal": @0, @"periods": @0, @"recurring_price_money": @{ }, @"uid": @"" } ] }, @"tax_data": @{ @"applies_to_custom_amounts": @NO, @"calculation_phase": @"", @"enabled": @NO, @"inclusion_type": @"", @"name": @"", @"percentage": @"" }, @"time_period_data": @{ @"event": @"" }, @"type": @"", @"updated_at": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/catalog/object"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/catalog/object" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/catalog/object",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'object' => [
'absent_at_location_ids' => [
],
'catalog_v1_ids' => [
[
'catalog_v1_id' => '',
'location_id' => ''
]
],
'category_data' => [
'name' => ''
],
'custom_attribute_definition_data' => [
'allowed_object_types' => [
],
'app_visibility' => '',
'custom_attribute_usage_count' => 0,
'description' => '',
'key' => '',
'name' => '',
'number_config' => [
'precision' => 0
],
'selection_config' => [
'allowed_selections' => [
[
'name' => '',
'uid' => ''
]
],
'max_allowed_selections' => 0
],
'seller_visibility' => '',
'source_application' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'string_config' => [
'enforce_uniqueness' => null
],
'type' => ''
],
'custom_attribute_values' => [
],
'discount_data' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'discount_type' => '',
'label_color' => '',
'modify_tax_basis' => '',
'name' => '',
'percentage' => '',
'pin_required' => null
],
'id' => '',
'image_data' => [
'caption' => '',
'name' => '',
'url' => ''
],
'image_id' => '',
'is_deleted' => null,
'item_data' => [
'abbreviation' => '',
'available_electronically' => null,
'available_for_pickup' => null,
'available_online' => null,
'category_id' => '',
'description' => '',
'item_options' => [
[
'item_option_id' => ''
]
],
'label_color' => '',
'modifier_list_info' => [
[
'enabled' => null,
'max_selected_modifiers' => 0,
'min_selected_modifiers' => 0,
'modifier_list_id' => '',
'modifier_overrides' => [
[
'modifier_id' => '',
'on_by_default' => null
]
]
]
],
'name' => '',
'product_type' => '',
'skip_modifier_screen' => null,
'sort_name' => '',
'tax_ids' => [
],
'variations' => [
]
],
'item_option_data' => [
'description' => '',
'display_name' => '',
'name' => '',
'show_colors' => null,
'values' => [
]
],
'item_option_value_data' => [
'color' => '',
'description' => '',
'item_option_id' => '',
'name' => '',
'ordinal' => 0
],
'item_variation_data' => [
'available_for_booking' => null,
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'item_id' => '',
'item_option_values' => [
[
'item_option_id' => '',
'item_option_value_id' => ''
]
],
'location_overrides' => [
[
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'location_id' => '',
'price_money' => [
],
'pricing_type' => '',
'track_inventory' => null
]
],
'measurement_unit_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
],
'pricing_type' => '',
'service_duration' => 0,
'sku' => '',
'stockable' => null,
'stockable_conversion' => [
'nonstockable_quantity' => '',
'stockable_item_variation_id' => '',
'stockable_quantity' => ''
],
'team_member_ids' => [
],
'track_inventory' => null,
'upc' => '',
'user_data' => ''
],
'measurement_unit_data' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'modifier_data' => [
'modifier_list_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
]
],
'modifier_list_data' => [
'modifiers' => [
],
'name' => '',
'ordinal' => 0,
'selection_type' => ''
],
'present_at_all_locations' => null,
'present_at_location_ids' => [
],
'pricing_rule_data' => [
'apply_products_id' => '',
'customer_group_ids_any' => [
],
'discount_id' => '',
'exclude_products_id' => '',
'exclude_strategy' => '',
'match_products_id' => '',
'name' => '',
'time_period_ids' => [
],
'valid_from_date' => '',
'valid_from_local_time' => '',
'valid_until_date' => '',
'valid_until_local_time' => ''
],
'product_set_data' => [
'all_products' => null,
'name' => '',
'product_ids_all' => [
],
'product_ids_any' => [
],
'quantity_exact' => 0,
'quantity_max' => 0,
'quantity_min' => 0
],
'quick_amounts_settings_data' => [
'amounts' => [
[
'amount' => [
],
'ordinal' => 0,
'score' => 0,
'type' => ''
]
],
'eligible_for_auto_amounts' => null,
'option' => ''
],
'subscription_plan_data' => [
'name' => '',
'phases' => [
[
'cadence' => '',
'ordinal' => 0,
'periods' => 0,
'recurring_price_money' => [
],
'uid' => ''
]
]
],
'tax_data' => [
'applies_to_custom_amounts' => null,
'calculation_phase' => '',
'enabled' => null,
'inclusion_type' => '',
'name' => '',
'percentage' => ''
],
'time_period_data' => [
'event' => ''
],
'type' => '',
'updated_at' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/catalog/object', [
'body' => '{
"idempotency_key": "",
"object": {
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/catalog/object');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'object' => [
'absent_at_location_ids' => [
],
'catalog_v1_ids' => [
[
'catalog_v1_id' => '',
'location_id' => ''
]
],
'category_data' => [
'name' => ''
],
'custom_attribute_definition_data' => [
'allowed_object_types' => [
],
'app_visibility' => '',
'custom_attribute_usage_count' => 0,
'description' => '',
'key' => '',
'name' => '',
'number_config' => [
'precision' => 0
],
'selection_config' => [
'allowed_selections' => [
[
'name' => '',
'uid' => ''
]
],
'max_allowed_selections' => 0
],
'seller_visibility' => '',
'source_application' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'string_config' => [
'enforce_uniqueness' => null
],
'type' => ''
],
'custom_attribute_values' => [
],
'discount_data' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'discount_type' => '',
'label_color' => '',
'modify_tax_basis' => '',
'name' => '',
'percentage' => '',
'pin_required' => null
],
'id' => '',
'image_data' => [
'caption' => '',
'name' => '',
'url' => ''
],
'image_id' => '',
'is_deleted' => null,
'item_data' => [
'abbreviation' => '',
'available_electronically' => null,
'available_for_pickup' => null,
'available_online' => null,
'category_id' => '',
'description' => '',
'item_options' => [
[
'item_option_id' => ''
]
],
'label_color' => '',
'modifier_list_info' => [
[
'enabled' => null,
'max_selected_modifiers' => 0,
'min_selected_modifiers' => 0,
'modifier_list_id' => '',
'modifier_overrides' => [
[
'modifier_id' => '',
'on_by_default' => null
]
]
]
],
'name' => '',
'product_type' => '',
'skip_modifier_screen' => null,
'sort_name' => '',
'tax_ids' => [
],
'variations' => [
]
],
'item_option_data' => [
'description' => '',
'display_name' => '',
'name' => '',
'show_colors' => null,
'values' => [
]
],
'item_option_value_data' => [
'color' => '',
'description' => '',
'item_option_id' => '',
'name' => '',
'ordinal' => 0
],
'item_variation_data' => [
'available_for_booking' => null,
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'item_id' => '',
'item_option_values' => [
[
'item_option_id' => '',
'item_option_value_id' => ''
]
],
'location_overrides' => [
[
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'location_id' => '',
'price_money' => [
],
'pricing_type' => '',
'track_inventory' => null
]
],
'measurement_unit_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
],
'pricing_type' => '',
'service_duration' => 0,
'sku' => '',
'stockable' => null,
'stockable_conversion' => [
'nonstockable_quantity' => '',
'stockable_item_variation_id' => '',
'stockable_quantity' => ''
],
'team_member_ids' => [
],
'track_inventory' => null,
'upc' => '',
'user_data' => ''
],
'measurement_unit_data' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'modifier_data' => [
'modifier_list_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
]
],
'modifier_list_data' => [
'modifiers' => [
],
'name' => '',
'ordinal' => 0,
'selection_type' => ''
],
'present_at_all_locations' => null,
'present_at_location_ids' => [
],
'pricing_rule_data' => [
'apply_products_id' => '',
'customer_group_ids_any' => [
],
'discount_id' => '',
'exclude_products_id' => '',
'exclude_strategy' => '',
'match_products_id' => '',
'name' => '',
'time_period_ids' => [
],
'valid_from_date' => '',
'valid_from_local_time' => '',
'valid_until_date' => '',
'valid_until_local_time' => ''
],
'product_set_data' => [
'all_products' => null,
'name' => '',
'product_ids_all' => [
],
'product_ids_any' => [
],
'quantity_exact' => 0,
'quantity_max' => 0,
'quantity_min' => 0
],
'quick_amounts_settings_data' => [
'amounts' => [
[
'amount' => [
],
'ordinal' => 0,
'score' => 0,
'type' => ''
]
],
'eligible_for_auto_amounts' => null,
'option' => ''
],
'subscription_plan_data' => [
'name' => '',
'phases' => [
[
'cadence' => '',
'ordinal' => 0,
'periods' => 0,
'recurring_price_money' => [
],
'uid' => ''
]
]
],
'tax_data' => [
'applies_to_custom_amounts' => null,
'calculation_phase' => '',
'enabled' => null,
'inclusion_type' => '',
'name' => '',
'percentage' => ''
],
'time_period_data' => [
'event' => ''
],
'type' => '',
'updated_at' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'object' => [
'absent_at_location_ids' => [
],
'catalog_v1_ids' => [
[
'catalog_v1_id' => '',
'location_id' => ''
]
],
'category_data' => [
'name' => ''
],
'custom_attribute_definition_data' => [
'allowed_object_types' => [
],
'app_visibility' => '',
'custom_attribute_usage_count' => 0,
'description' => '',
'key' => '',
'name' => '',
'number_config' => [
'precision' => 0
],
'selection_config' => [
'allowed_selections' => [
[
'name' => '',
'uid' => ''
]
],
'max_allowed_selections' => 0
],
'seller_visibility' => '',
'source_application' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'string_config' => [
'enforce_uniqueness' => null
],
'type' => ''
],
'custom_attribute_values' => [
],
'discount_data' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'discount_type' => '',
'label_color' => '',
'modify_tax_basis' => '',
'name' => '',
'percentage' => '',
'pin_required' => null
],
'id' => '',
'image_data' => [
'caption' => '',
'name' => '',
'url' => ''
],
'image_id' => '',
'is_deleted' => null,
'item_data' => [
'abbreviation' => '',
'available_electronically' => null,
'available_for_pickup' => null,
'available_online' => null,
'category_id' => '',
'description' => '',
'item_options' => [
[
'item_option_id' => ''
]
],
'label_color' => '',
'modifier_list_info' => [
[
'enabled' => null,
'max_selected_modifiers' => 0,
'min_selected_modifiers' => 0,
'modifier_list_id' => '',
'modifier_overrides' => [
[
'modifier_id' => '',
'on_by_default' => null
]
]
]
],
'name' => '',
'product_type' => '',
'skip_modifier_screen' => null,
'sort_name' => '',
'tax_ids' => [
],
'variations' => [
]
],
'item_option_data' => [
'description' => '',
'display_name' => '',
'name' => '',
'show_colors' => null,
'values' => [
]
],
'item_option_value_data' => [
'color' => '',
'description' => '',
'item_option_id' => '',
'name' => '',
'ordinal' => 0
],
'item_variation_data' => [
'available_for_booking' => null,
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'item_id' => '',
'item_option_values' => [
[
'item_option_id' => '',
'item_option_value_id' => ''
]
],
'location_overrides' => [
[
'inventory_alert_threshold' => 0,
'inventory_alert_type' => '',
'location_id' => '',
'price_money' => [
],
'pricing_type' => '',
'track_inventory' => null
]
],
'measurement_unit_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
],
'pricing_type' => '',
'service_duration' => 0,
'sku' => '',
'stockable' => null,
'stockable_conversion' => [
'nonstockable_quantity' => '',
'stockable_item_variation_id' => '',
'stockable_quantity' => ''
],
'team_member_ids' => [
],
'track_inventory' => null,
'upc' => '',
'user_data' => ''
],
'measurement_unit_data' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'modifier_data' => [
'modifier_list_id' => '',
'name' => '',
'ordinal' => 0,
'price_money' => [
]
],
'modifier_list_data' => [
'modifiers' => [
],
'name' => '',
'ordinal' => 0,
'selection_type' => ''
],
'present_at_all_locations' => null,
'present_at_location_ids' => [
],
'pricing_rule_data' => [
'apply_products_id' => '',
'customer_group_ids_any' => [
],
'discount_id' => '',
'exclude_products_id' => '',
'exclude_strategy' => '',
'match_products_id' => '',
'name' => '',
'time_period_ids' => [
],
'valid_from_date' => '',
'valid_from_local_time' => '',
'valid_until_date' => '',
'valid_until_local_time' => ''
],
'product_set_data' => [
'all_products' => null,
'name' => '',
'product_ids_all' => [
],
'product_ids_any' => [
],
'quantity_exact' => 0,
'quantity_max' => 0,
'quantity_min' => 0
],
'quick_amounts_settings_data' => [
'amounts' => [
[
'amount' => [
],
'ordinal' => 0,
'score' => 0,
'type' => ''
]
],
'eligible_for_auto_amounts' => null,
'option' => ''
],
'subscription_plan_data' => [
'name' => '',
'phases' => [
[
'cadence' => '',
'ordinal' => 0,
'periods' => 0,
'recurring_price_money' => [
],
'uid' => ''
]
]
],
'tax_data' => [
'applies_to_custom_amounts' => null,
'calculation_phase' => '',
'enabled' => null,
'inclusion_type' => '',
'name' => '',
'percentage' => ''
],
'time_period_data' => [
'event' => ''
],
'type' => '',
'updated_at' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/catalog/object');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/catalog/object' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"object": {
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/catalog/object' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"object": {
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/catalog/object", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/catalog/object"
payload = {
"idempotency_key": "",
"object": {
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": { "name": "" },
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": { "precision": 0 },
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": { "enforce_uniqueness": False },
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": False
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": False,
"item_data": {
"abbreviation": "",
"available_electronically": False,
"available_for_pickup": False,
"available_online": False,
"category_id": "",
"description": "",
"item_options": [{ "item_option_id": "" }],
"label_color": "",
"modifier_list_info": [
{
"enabled": False,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": False
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": False,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": False,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": False,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": False
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": False,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": False,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": False,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": False,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": False,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": False,
"calculation_phase": "",
"enabled": False,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": { "event": "" },
"type": "",
"updated_at": "",
"version": 0
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/catalog/object"
payload <- "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/catalog/object")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/catalog/object') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"object\": {\n \"absent_at_location_ids\": [],\n \"catalog_v1_ids\": [\n {\n \"catalog_v1_id\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"category_data\": {\n \"name\": \"\"\n },\n \"custom_attribute_definition_data\": {\n \"allowed_object_types\": [],\n \"app_visibility\": \"\",\n \"custom_attribute_usage_count\": 0,\n \"description\": \"\",\n \"key\": \"\",\n \"name\": \"\",\n \"number_config\": {\n \"precision\": 0\n },\n \"selection_config\": {\n \"allowed_selections\": [\n {\n \"name\": \"\",\n \"uid\": \"\"\n }\n ],\n \"max_allowed_selections\": 0\n },\n \"seller_visibility\": \"\",\n \"source_application\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"string_config\": {\n \"enforce_uniqueness\": false\n },\n \"type\": \"\"\n },\n \"custom_attribute_values\": {},\n \"discount_data\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"discount_type\": \"\",\n \"label_color\": \"\",\n \"modify_tax_basis\": \"\",\n \"name\": \"\",\n \"percentage\": \"\",\n \"pin_required\": false\n },\n \"id\": \"\",\n \"image_data\": {\n \"caption\": \"\",\n \"name\": \"\",\n \"url\": \"\"\n },\n \"image_id\": \"\",\n \"is_deleted\": false,\n \"item_data\": {\n \"abbreviation\": \"\",\n \"available_electronically\": false,\n \"available_for_pickup\": false,\n \"available_online\": false,\n \"category_id\": \"\",\n \"description\": \"\",\n \"item_options\": [\n {\n \"item_option_id\": \"\"\n }\n ],\n \"label_color\": \"\",\n \"modifier_list_info\": [\n {\n \"enabled\": false,\n \"max_selected_modifiers\": 0,\n \"min_selected_modifiers\": 0,\n \"modifier_list_id\": \"\",\n \"modifier_overrides\": [\n {\n \"modifier_id\": \"\",\n \"on_by_default\": false\n }\n ]\n }\n ],\n \"name\": \"\",\n \"product_type\": \"\",\n \"skip_modifier_screen\": false,\n \"sort_name\": \"\",\n \"tax_ids\": [],\n \"variations\": []\n },\n \"item_option_data\": {\n \"description\": \"\",\n \"display_name\": \"\",\n \"name\": \"\",\n \"show_colors\": false,\n \"values\": []\n },\n \"item_option_value_data\": {\n \"color\": \"\",\n \"description\": \"\",\n \"item_option_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0\n },\n \"item_variation_data\": {\n \"available_for_booking\": false,\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"item_id\": \"\",\n \"item_option_values\": [\n {\n \"item_option_id\": \"\",\n \"item_option_value_id\": \"\"\n }\n ],\n \"location_overrides\": [\n {\n \"inventory_alert_threshold\": 0,\n \"inventory_alert_type\": \"\",\n \"location_id\": \"\",\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"track_inventory\": false\n }\n ],\n \"measurement_unit_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {},\n \"pricing_type\": \"\",\n \"service_duration\": 0,\n \"sku\": \"\",\n \"stockable\": false,\n \"stockable_conversion\": {\n \"nonstockable_quantity\": \"\",\n \"stockable_item_variation_id\": \"\",\n \"stockable_quantity\": \"\"\n },\n \"team_member_ids\": [],\n \"track_inventory\": false,\n \"upc\": \"\",\n \"user_data\": \"\"\n },\n \"measurement_unit_data\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"modifier_data\": {\n \"modifier_list_id\": \"\",\n \"name\": \"\",\n \"ordinal\": 0,\n \"price_money\": {}\n },\n \"modifier_list_data\": {\n \"modifiers\": [],\n \"name\": \"\",\n \"ordinal\": 0,\n \"selection_type\": \"\"\n },\n \"present_at_all_locations\": false,\n \"present_at_location_ids\": [],\n \"pricing_rule_data\": {\n \"apply_products_id\": \"\",\n \"customer_group_ids_any\": [],\n \"discount_id\": \"\",\n \"exclude_products_id\": \"\",\n \"exclude_strategy\": \"\",\n \"match_products_id\": \"\",\n \"name\": \"\",\n \"time_period_ids\": [],\n \"valid_from_date\": \"\",\n \"valid_from_local_time\": \"\",\n \"valid_until_date\": \"\",\n \"valid_until_local_time\": \"\"\n },\n \"product_set_data\": {\n \"all_products\": false,\n \"name\": \"\",\n \"product_ids_all\": [],\n \"product_ids_any\": [],\n \"quantity_exact\": 0,\n \"quantity_max\": 0,\n \"quantity_min\": 0\n },\n \"quick_amounts_settings_data\": {\n \"amounts\": [\n {\n \"amount\": {},\n \"ordinal\": 0,\n \"score\": 0,\n \"type\": \"\"\n }\n ],\n \"eligible_for_auto_amounts\": false,\n \"option\": \"\"\n },\n \"subscription_plan_data\": {\n \"name\": \"\",\n \"phases\": [\n {\n \"cadence\": \"\",\n \"ordinal\": 0,\n \"periods\": 0,\n \"recurring_price_money\": {},\n \"uid\": \"\"\n }\n ]\n },\n \"tax_data\": {\n \"applies_to_custom_amounts\": false,\n \"calculation_phase\": \"\",\n \"enabled\": false,\n \"inclusion_type\": \"\",\n \"name\": \"\",\n \"percentage\": \"\"\n },\n \"time_period_data\": {\n \"event\": \"\"\n },\n \"type\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/catalog/object";
let payload = json!({
"idempotency_key": "",
"object": json!({
"absent_at_location_ids": (),
"catalog_v1_ids": (
json!({
"catalog_v1_id": "",
"location_id": ""
})
),
"category_data": json!({"name": ""}),
"custom_attribute_definition_data": json!({
"allowed_object_types": (),
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": json!({"precision": 0}),
"selection_config": json!({
"allowed_selections": (
json!({
"name": "",
"uid": ""
})
),
"max_allowed_selections": 0
}),
"seller_visibility": "",
"source_application": json!({
"application_id": "",
"name": "",
"product": ""
}),
"string_config": json!({"enforce_uniqueness": false}),
"type": ""
}),
"custom_attribute_values": json!({}),
"discount_data": json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
}),
"id": "",
"image_data": json!({
"caption": "",
"name": "",
"url": ""
}),
"image_id": "",
"is_deleted": false,
"item_data": json!({
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": (json!({"item_option_id": ""})),
"label_color": "",
"modifier_list_info": (
json!({
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": (
json!({
"modifier_id": "",
"on_by_default": false
})
)
})
),
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": (),
"variations": ()
}),
"item_option_data": json!({
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": ()
}),
"item_option_value_data": json!({
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
}),
"item_variation_data": json!({
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": (
json!({
"item_option_id": "",
"item_option_value_id": ""
})
),
"location_overrides": (
json!({
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": json!({}),
"pricing_type": "",
"track_inventory": false
})
),
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": json!({}),
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": json!({
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
}),
"team_member_ids": (),
"track_inventory": false,
"upc": "",
"user_data": ""
}),
"measurement_unit_data": json!({
"measurement_unit": json!({
"area_unit": "",
"custom_unit": json!({
"abbreviation": "",
"name": ""
}),
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
}),
"precision": 0
}),
"modifier_data": json!({
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": json!({})
}),
"modifier_list_data": json!({
"modifiers": (),
"name": "",
"ordinal": 0,
"selection_type": ""
}),
"present_at_all_locations": false,
"present_at_location_ids": (),
"pricing_rule_data": json!({
"apply_products_id": "",
"customer_group_ids_any": (),
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": (),
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
}),
"product_set_data": json!({
"all_products": false,
"name": "",
"product_ids_all": (),
"product_ids_any": (),
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
}),
"quick_amounts_settings_data": json!({
"amounts": (
json!({
"amount": json!({}),
"ordinal": 0,
"score": 0,
"type": ""
})
),
"eligible_for_auto_amounts": false,
"option": ""
}),
"subscription_plan_data": json!({
"name": "",
"phases": (
json!({
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": json!({}),
"uid": ""
})
)
}),
"tax_data": json!({
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
}),
"time_period_data": json!({"event": ""}),
"type": "",
"updated_at": "",
"version": 0
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/catalog/object \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"object": {
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
}'
echo '{
"idempotency_key": "",
"object": {
"absent_at_location_ids": [],
"catalog_v1_ids": [
{
"catalog_v1_id": "",
"location_id": ""
}
],
"category_data": {
"name": ""
},
"custom_attribute_definition_data": {
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": {
"precision": 0
},
"selection_config": {
"allowed_selections": [
{
"name": "",
"uid": ""
}
],
"max_allowed_selections": 0
},
"seller_visibility": "",
"source_application": {
"application_id": "",
"name": "",
"product": ""
},
"string_config": {
"enforce_uniqueness": false
},
"type": ""
},
"custom_attribute_values": {},
"discount_data": {
"amount_money": {
"amount": 0,
"currency": ""
},
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
},
"id": "",
"image_data": {
"caption": "",
"name": "",
"url": ""
},
"image_id": "",
"is_deleted": false,
"item_data": {
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [
{
"item_option_id": ""
}
],
"label_color": "",
"modifier_list_info": [
{
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
{
"modifier_id": "",
"on_by_default": false
}
]
}
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
},
"item_option_data": {
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
},
"item_option_value_data": {
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
},
"item_variation_data": {
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
{
"item_option_id": "",
"item_option_value_id": ""
}
],
"location_overrides": [
{
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": {},
"pricing_type": "",
"track_inventory": false
}
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": {},
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": {
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
},
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
},
"measurement_unit_data": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"modifier_data": {
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": {}
},
"modifier_list_data": {
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
},
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": {
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
},
"product_set_data": {
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
},
"quick_amounts_settings_data": {
"amounts": [
{
"amount": {},
"ordinal": 0,
"score": 0,
"type": ""
}
],
"eligible_for_auto_amounts": false,
"option": ""
},
"subscription_plan_data": {
"name": "",
"phases": [
{
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": {},
"uid": ""
}
]
},
"tax_data": {
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
},
"time_period_data": {
"event": ""
},
"type": "",
"updated_at": "",
"version": 0
}
}' | \
http POST {{baseUrl}}/v2/catalog/object \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "object": {\n "absent_at_location_ids": [],\n "catalog_v1_ids": [\n {\n "catalog_v1_id": "",\n "location_id": ""\n }\n ],\n "category_data": {\n "name": ""\n },\n "custom_attribute_definition_data": {\n "allowed_object_types": [],\n "app_visibility": "",\n "custom_attribute_usage_count": 0,\n "description": "",\n "key": "",\n "name": "",\n "number_config": {\n "precision": 0\n },\n "selection_config": {\n "allowed_selections": [\n {\n "name": "",\n "uid": ""\n }\n ],\n "max_allowed_selections": 0\n },\n "seller_visibility": "",\n "source_application": {\n "application_id": "",\n "name": "",\n "product": ""\n },\n "string_config": {\n "enforce_uniqueness": false\n },\n "type": ""\n },\n "custom_attribute_values": {},\n "discount_data": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "discount_type": "",\n "label_color": "",\n "modify_tax_basis": "",\n "name": "",\n "percentage": "",\n "pin_required": false\n },\n "id": "",\n "image_data": {\n "caption": "",\n "name": "",\n "url": ""\n },\n "image_id": "",\n "is_deleted": false,\n "item_data": {\n "abbreviation": "",\n "available_electronically": false,\n "available_for_pickup": false,\n "available_online": false,\n "category_id": "",\n "description": "",\n "item_options": [\n {\n "item_option_id": ""\n }\n ],\n "label_color": "",\n "modifier_list_info": [\n {\n "enabled": false,\n "max_selected_modifiers": 0,\n "min_selected_modifiers": 0,\n "modifier_list_id": "",\n "modifier_overrides": [\n {\n "modifier_id": "",\n "on_by_default": false\n }\n ]\n }\n ],\n "name": "",\n "product_type": "",\n "skip_modifier_screen": false,\n "sort_name": "",\n "tax_ids": [],\n "variations": []\n },\n "item_option_data": {\n "description": "",\n "display_name": "",\n "name": "",\n "show_colors": false,\n "values": []\n },\n "item_option_value_data": {\n "color": "",\n "description": "",\n "item_option_id": "",\n "name": "",\n "ordinal": 0\n },\n "item_variation_data": {\n "available_for_booking": false,\n "inventory_alert_threshold": 0,\n "inventory_alert_type": "",\n "item_id": "",\n "item_option_values": [\n {\n "item_option_id": "",\n "item_option_value_id": ""\n }\n ],\n "location_overrides": [\n {\n "inventory_alert_threshold": 0,\n "inventory_alert_type": "",\n "location_id": "",\n "price_money": {},\n "pricing_type": "",\n "track_inventory": false\n }\n ],\n "measurement_unit_id": "",\n "name": "",\n "ordinal": 0,\n "price_money": {},\n "pricing_type": "",\n "service_duration": 0,\n "sku": "",\n "stockable": false,\n "stockable_conversion": {\n "nonstockable_quantity": "",\n "stockable_item_variation_id": "",\n "stockable_quantity": ""\n },\n "team_member_ids": [],\n "track_inventory": false,\n "upc": "",\n "user_data": ""\n },\n "measurement_unit_data": {\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "modifier_data": {\n "modifier_list_id": "",\n "name": "",\n "ordinal": 0,\n "price_money": {}\n },\n "modifier_list_data": {\n "modifiers": [],\n "name": "",\n "ordinal": 0,\n "selection_type": ""\n },\n "present_at_all_locations": false,\n "present_at_location_ids": [],\n "pricing_rule_data": {\n "apply_products_id": "",\n "customer_group_ids_any": [],\n "discount_id": "",\n "exclude_products_id": "",\n "exclude_strategy": "",\n "match_products_id": "",\n "name": "",\n "time_period_ids": [],\n "valid_from_date": "",\n "valid_from_local_time": "",\n "valid_until_date": "",\n "valid_until_local_time": ""\n },\n "product_set_data": {\n "all_products": false,\n "name": "",\n "product_ids_all": [],\n "product_ids_any": [],\n "quantity_exact": 0,\n "quantity_max": 0,\n "quantity_min": 0\n },\n "quick_amounts_settings_data": {\n "amounts": [\n {\n "amount": {},\n "ordinal": 0,\n "score": 0,\n "type": ""\n }\n ],\n "eligible_for_auto_amounts": false,\n "option": ""\n },\n "subscription_plan_data": {\n "name": "",\n "phases": [\n {\n "cadence": "",\n "ordinal": 0,\n "periods": 0,\n "recurring_price_money": {},\n "uid": ""\n }\n ]\n },\n "tax_data": {\n "applies_to_custom_amounts": false,\n "calculation_phase": "",\n "enabled": false,\n "inclusion_type": "",\n "name": "",\n "percentage": ""\n },\n "time_period_data": {\n "event": ""\n },\n "type": "",\n "updated_at": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/catalog/object
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"object": [
"absent_at_location_ids": [],
"catalog_v1_ids": [
[
"catalog_v1_id": "",
"location_id": ""
]
],
"category_data": ["name": ""],
"custom_attribute_definition_data": [
"allowed_object_types": [],
"app_visibility": "",
"custom_attribute_usage_count": 0,
"description": "",
"key": "",
"name": "",
"number_config": ["precision": 0],
"selection_config": [
"allowed_selections": [
[
"name": "",
"uid": ""
]
],
"max_allowed_selections": 0
],
"seller_visibility": "",
"source_application": [
"application_id": "",
"name": "",
"product": ""
],
"string_config": ["enforce_uniqueness": false],
"type": ""
],
"custom_attribute_values": [],
"discount_data": [
"amount_money": [
"amount": 0,
"currency": ""
],
"discount_type": "",
"label_color": "",
"modify_tax_basis": "",
"name": "",
"percentage": "",
"pin_required": false
],
"id": "",
"image_data": [
"caption": "",
"name": "",
"url": ""
],
"image_id": "",
"is_deleted": false,
"item_data": [
"abbreviation": "",
"available_electronically": false,
"available_for_pickup": false,
"available_online": false,
"category_id": "",
"description": "",
"item_options": [["item_option_id": ""]],
"label_color": "",
"modifier_list_info": [
[
"enabled": false,
"max_selected_modifiers": 0,
"min_selected_modifiers": 0,
"modifier_list_id": "",
"modifier_overrides": [
[
"modifier_id": "",
"on_by_default": false
]
]
]
],
"name": "",
"product_type": "",
"skip_modifier_screen": false,
"sort_name": "",
"tax_ids": [],
"variations": []
],
"item_option_data": [
"description": "",
"display_name": "",
"name": "",
"show_colors": false,
"values": []
],
"item_option_value_data": [
"color": "",
"description": "",
"item_option_id": "",
"name": "",
"ordinal": 0
],
"item_variation_data": [
"available_for_booking": false,
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"item_id": "",
"item_option_values": [
[
"item_option_id": "",
"item_option_value_id": ""
]
],
"location_overrides": [
[
"inventory_alert_threshold": 0,
"inventory_alert_type": "",
"location_id": "",
"price_money": [],
"pricing_type": "",
"track_inventory": false
]
],
"measurement_unit_id": "",
"name": "",
"ordinal": 0,
"price_money": [],
"pricing_type": "",
"service_duration": 0,
"sku": "",
"stockable": false,
"stockable_conversion": [
"nonstockable_quantity": "",
"stockable_item_variation_id": "",
"stockable_quantity": ""
],
"team_member_ids": [],
"track_inventory": false,
"upc": "",
"user_data": ""
],
"measurement_unit_data": [
"measurement_unit": [
"area_unit": "",
"custom_unit": [
"abbreviation": "",
"name": ""
],
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
],
"precision": 0
],
"modifier_data": [
"modifier_list_id": "",
"name": "",
"ordinal": 0,
"price_money": []
],
"modifier_list_data": [
"modifiers": [],
"name": "",
"ordinal": 0,
"selection_type": ""
],
"present_at_all_locations": false,
"present_at_location_ids": [],
"pricing_rule_data": [
"apply_products_id": "",
"customer_group_ids_any": [],
"discount_id": "",
"exclude_products_id": "",
"exclude_strategy": "",
"match_products_id": "",
"name": "",
"time_period_ids": [],
"valid_from_date": "",
"valid_from_local_time": "",
"valid_until_date": "",
"valid_until_local_time": ""
],
"product_set_data": [
"all_products": false,
"name": "",
"product_ids_all": [],
"product_ids_any": [],
"quantity_exact": 0,
"quantity_max": 0,
"quantity_min": 0
],
"quick_amounts_settings_data": [
"amounts": [
[
"amount": [],
"ordinal": 0,
"score": 0,
"type": ""
]
],
"eligible_for_auto_amounts": false,
"option": ""
],
"subscription_plan_data": [
"name": "",
"phases": [
[
"cadence": "",
"ordinal": 0,
"periods": 0,
"recurring_price_money": [],
"uid": ""
]
]
],
"tax_data": [
"applies_to_custom_amounts": false,
"calculation_phase": "",
"enabled": false,
"inclusion_type": "",
"name": "",
"percentage": ""
],
"time_period_data": ["event": ""],
"type": "",
"updated_at": "",
"version": 0
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/catalog/object")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"catalog_object": {
"id": "R2TA2FOBUGCJZNIWJSOSNAI4",
"is_deleted": false,
"item_data": {
"abbreviation": "Ch",
"description": "Hot Chocolate",
"name": "Cocoa",
"product_type": "REGULAR",
"variations": [
{
"id": "QRT53UP4LITLWGOGBZCUWP63",
"is_deleted": false,
"item_variation_data": {
"item_id": "R2TA2FOBUGCJZNIWJSOSNAI4",
"name": "Small",
"ordinal": 0,
"pricing_type": "VARIABLE_PRICING",
"stockable": true
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2021-06-14T15:51:39.021Z",
"version": 1623685899021
},
{
"id": "NS77DKEIQ3AEQTCP727DSA7U",
"is_deleted": false,
"item_variation_data": {
"item_id": "R2TA2FOBUGCJZNIWJSOSNAI4",
"name": "Large",
"ordinal": 1,
"price_money": {
"amount": 400,
"currency": "USD"
},
"pricing_type": "FIXED_PRICING",
"stockable": true
},
"present_at_all_locations": true,
"type": "ITEM_VARIATION",
"updated_at": "2021-06-14T15:51:39.021Z",
"version": 1623685899021
}
]
},
"present_at_all_locations": true,
"type": "ITEM",
"updated_at": "2021-06-14T15:51:39.021Z",
"version": 1623685899021
},
"id_mappings": [
{
"client_object_id": "#Cocoa",
"object_id": "R2TA2FOBUGCJZNIWJSOSNAI4"
},
{
"client_object_id": "#Small",
"object_id": "QRT53UP4LITLWGOGBZCUWP63"
},
{
"client_object_id": "#Large",
"object_id": "NS77DKEIQ3AEQTCP727DSA7U"
}
]
}
POST
CreateCheckout
{{baseUrl}}/v2/locations/:location_id/checkouts
QUERY PARAMS
location_id
BODY json
{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": ""
}
],
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
},
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": {},
"redirect_url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id/checkouts");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/locations/:location_id/checkouts" {:content-type :json
:form-params {:additional_recipients [{:amount_money {:amount 0
:currency ""}
:description ""
:location_id ""}]
:ask_for_shipping_address false
:idempotency_key ""
:merchant_support_email ""
:note ""
:order {:idempotency_key ""
:order {:closed_at ""
:created_at ""
:customer_id ""
:discounts [{:amount_money {}
:applied_money {}
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:pricing_rule_id ""
:reward_ids []
:scope ""
:type ""
:uid ""}]
:fulfillments [{:metadata {}
:pickup_details {:accepted_at ""
:auto_complete_duration ""
:cancel_reason ""
:canceled_at ""
:curbside_pickup_details {:buyer_arrived_at ""
:curbside_details ""}
:expired_at ""
:expires_at ""
:is_curbside_pickup false
:note ""
:picked_up_at ""
:pickup_at ""
:pickup_window_duration ""
:placed_at ""
:prep_time_duration ""
:ready_at ""
:recipient {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:customer_id ""
:display_name ""
:email_address ""
:phone_number ""}
:rejected_at ""
:schedule_type ""}
:shipment_details {:cancel_reason ""
:canceled_at ""
:carrier ""
:expected_shipped_at ""
:failed_at ""
:failure_reason ""
:in_progress_at ""
:packaged_at ""
:placed_at ""
:recipient {}
:shipped_at ""
:shipping_note ""
:shipping_type ""
:tracking_number ""
:tracking_url ""}
:state ""
:type ""
:uid ""}]
:id ""
:line_items [{:applied_discounts [{:applied_money {}
:discount_uid ""
:uid ""}]
:applied_taxes [{:applied_money {}
:tax_uid ""
:uid ""}]
:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:gross_sales_money {}
:item_type ""
:metadata {}
:modifiers [{:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:total_price_money {}
:uid ""}]
:name ""
:note ""
:pricing_blocklists {:blocked_discounts [{:discount_catalog_object_id ""
:discount_uid ""
:uid ""}]
:blocked_taxes [{:tax_catalog_object_id ""
:tax_uid ""
:uid ""}]}
:quantity ""
:quantity_unit {:catalog_version 0
:measurement_unit {:area_unit ""
:custom_unit {:abbreviation ""
:name ""}
:generic_unit ""
:length_unit ""
:time_unit ""
:type ""
:volume_unit ""
:weight_unit ""}
:precision 0}
:total_discount_money {}
:total_money {}
:total_tax_money {}
:uid ""
:variation_name ""
:variation_total_price_money {}}]
:location_id ""
:metadata {}
:net_amounts {:discount_money {}
:service_charge_money {}
:tax_money {}
:tip_money {}
:total_money {}}
:pricing_options {:auto_apply_discounts false
:auto_apply_taxes false}
:reference_id ""
:refunds [{:additional_recipients [{:amount_money {}
:description ""
:location_id ""
:receivable_id ""}]
:amount_money {}
:created_at ""
:id ""
:location_id ""
:processing_fee_money {}
:reason ""
:status ""
:tender_id ""
:transaction_id ""}]
:return_amounts {}
:returns [{:return_amounts {}
:return_discounts [{:amount_money {}
:applied_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:scope ""
:source_discount_uid ""
:type ""
:uid ""}]
:return_line_items [{:applied_discounts [{}]
:applied_taxes [{}]
:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:gross_return_money {}
:item_type ""
:name ""
:note ""
:quantity ""
:quantity_unit {}
:return_modifiers [{:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:source_modifier_uid ""
:total_price_money {}
:uid ""}]
:source_line_item_uid ""
:total_discount_money {}
:total_money {}
:total_tax_money {}
:uid ""
:variation_name ""
:variation_total_price_money {}}]
:return_service_charges [{:amount_money {}
:applied_money {}
:applied_taxes [{}]
:calculation_phase ""
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:source_service_charge_uid ""
:taxable false
:total_money {}
:total_tax_money {}
:uid ""}]
:return_taxes [{:applied_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:scope ""
:source_tax_uid ""
:type ""
:uid ""}]
:rounding_adjustment {:amount_money {}
:name ""
:uid ""}
:source_order_id ""
:uid ""}]
:rewards [{:id ""
:reward_tier_id ""}]
:rounding_adjustment {}
:service_charges [{:amount_money {}
:applied_money {}
:applied_taxes [{}]
:calculation_phase ""
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:taxable false
:total_money {}
:total_tax_money {}
:type ""
:uid ""}]
:source {:name ""}
:state ""
:taxes [{:applied_money {}
:auto_applied false
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:scope ""
:type ""
:uid ""}]
:tenders [{:additional_recipients [{}]
:amount_money {}
:card_details {:card {:billing_address {}
:bin ""
:card_brand ""
:card_type ""
:cardholder_name ""
:customer_id ""
:enabled false
:exp_month 0
:exp_year 0
:fingerprint ""
:id ""
:last_4 ""
:prepaid_type ""
:reference_id ""
:version 0}
:entry_method ""
:status ""}
:cash_details {:buyer_tendered_money {}
:change_back_money {}}
:created_at ""
:customer_id ""
:id ""
:location_id ""
:note ""
:payment_id ""
:processing_fee_money {}
:tip_money {}
:transaction_id ""
:type ""}]
:total_discount_money {}
:total_money {}
:total_service_charge_money {}
:total_tax_money {}
:total_tip_money {}
:updated_at ""
:version 0}}
:pre_populate_buyer_email ""
:pre_populate_shipping_address {}
:redirect_url ""}})
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id/checkouts"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id/checkouts"),
Content = new StringContent("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id/checkouts");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id/checkouts"
payload := strings.NewReader("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/locations/:location_id/checkouts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 11020
{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": ""
}
],
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
},
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": {},
"redirect_url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/locations/:location_id/checkouts")
.setHeader("content-type", "application/json")
.setBody("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id/checkouts"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/checkouts")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/locations/:location_id/checkouts")
.header("content-type", "application/json")
.body("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}")
.asString();
const data = JSON.stringify({
additional_recipients: [
{
amount_money: {
amount: 0,
currency: ''
},
description: '',
location_id: ''
}
],
ask_for_shipping_address: false,
idempotency_key: '',
merchant_support_email: '',
note: '',
order: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {
buyer_arrived_at: '',
curbside_details: ''
},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [
{
applied_money: {},
discount_uid: '',
uid: ''
}
],
applied_taxes: [
{
applied_money: {},
tax_uid: '',
uid: ''
}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [
{
discount_catalog_object_id: '',
discount_uid: '',
uid: ''
}
],
blocked_taxes: [
{
tax_catalog_object_id: '',
tax_uid: '',
uid: ''
}
]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {
auto_apply_discounts: false,
auto_apply_taxes: false
},
reference_id: '',
refunds: [
{
additional_recipients: [
{
amount_money: {},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [
{}
],
applied_taxes: [
{}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {
amount_money: {},
name: '',
uid: ''
},
source_order_id: '',
uid: ''
}
],
rewards: [
{
id: '',
reward_tier_id: ''
}
],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {
name: ''
},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [
{}
],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {
buyer_tendered_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
},
pre_populate_buyer_email: '',
pre_populate_shipping_address: {},
redirect_url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/locations/:location_id/checkouts');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/checkouts',
headers: {'content-type': 'application/json'},
data: {
additional_recipients: [{amount_money: {amount: 0, currency: ''}, description: '', location_id: ''}],
ask_for_shipping_address: false,
idempotency_key: '',
merchant_support_email: '',
note: '',
order: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
},
pre_populate_buyer_email: '',
pre_populate_shipping_address: {},
redirect_url: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id/checkouts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additional_recipients":[{"amount_money":{"amount":0,"currency":""},"description":"","location_id":""}],"ask_for_shipping_address":false,"idempotency_key":"","merchant_support_email":"","note":"","order":{"idempotency_key":"","order":{"closed_at":"","created_at":"","customer_id":"","discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","pricing_rule_id":"","reward_ids":[],"scope":"","type":"","uid":""}],"fulfillments":[{"metadata":{},"pickup_details":{"accepted_at":"","auto_complete_duration":"","cancel_reason":"","canceled_at":"","curbside_pickup_details":{"buyer_arrived_at":"","curbside_details":""},"expired_at":"","expires_at":"","is_curbside_pickup":false,"note":"","picked_up_at":"","pickup_at":"","pickup_window_duration":"","placed_at":"","prep_time_duration":"","ready_at":"","recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"customer_id":"","display_name":"","email_address":"","phone_number":""},"rejected_at":"","schedule_type":""},"shipment_details":{"cancel_reason":"","canceled_at":"","carrier":"","expected_shipped_at":"","failed_at":"","failure_reason":"","in_progress_at":"","packaged_at":"","placed_at":"","recipient":{},"shipped_at":"","shipping_note":"","shipping_type":"","tracking_number":"","tracking_url":""},"state":"","type":"","uid":""}],"id":"","line_items":[{"applied_discounts":[{"applied_money":{},"discount_uid":"","uid":""}],"applied_taxes":[{"applied_money":{},"tax_uid":"","uid":""}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_sales_money":{},"item_type":"","metadata":{},"modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","total_price_money":{},"uid":""}],"name":"","note":"","pricing_blocklists":{"blocked_discounts":[{"discount_catalog_object_id":"","discount_uid":"","uid":""}],"blocked_taxes":[{"tax_catalog_object_id":"","tax_uid":"","uid":""}]},"quantity":"","quantity_unit":{"catalog_version":0,"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"location_id":"","metadata":{},"net_amounts":{"discount_money":{},"service_charge_money":{},"tax_money":{},"tip_money":{},"total_money":{}},"pricing_options":{"auto_apply_discounts":false,"auto_apply_taxes":false},"reference_id":"","refunds":[{"additional_recipients":[{"amount_money":{},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"created_at":"","id":"","location_id":"","processing_fee_money":{},"reason":"","status":"","tender_id":"","transaction_id":""}],"return_amounts":{},"returns":[{"return_amounts":{},"return_discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_discount_uid":"","type":"","uid":""}],"return_line_items":[{"applied_discounts":[{}],"applied_taxes":[{}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_return_money":{},"item_type":"","name":"","note":"","quantity":"","quantity_unit":{},"return_modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","source_modifier_uid":"","total_price_money":{},"uid":""}],"source_line_item_uid":"","total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"return_service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"name":"","percentage":"","source_service_charge_uid":"","taxable":false,"total_money":{},"total_tax_money":{},"uid":""}],"return_taxes":[{"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_tax_uid":"","type":"","uid":""}],"rounding_adjustment":{"amount_money":{},"name":"","uid":""},"source_order_id":"","uid":""}],"rewards":[{"id":"","reward_tier_id":""}],"rounding_adjustment":{},"service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","taxable":false,"total_money":{},"total_tax_money":{},"type":"","uid":""}],"source":{"name":""},"state":"","taxes":[{"applied_money":{},"auto_applied":false,"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","scope":"","type":"","uid":""}],"tenders":[{"additional_recipients":[{}],"amount_money":{},"card_details":{"card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"entry_method":"","status":""},"cash_details":{"buyer_tendered_money":{},"change_back_money":{}},"created_at":"","customer_id":"","id":"","location_id":"","note":"","payment_id":"","processing_fee_money":{},"tip_money":{},"transaction_id":"","type":""}],"total_discount_money":{},"total_money":{},"total_service_charge_money":{},"total_tax_money":{},"total_tip_money":{},"updated_at":"","version":0}},"pre_populate_buyer_email":"","pre_populate_shipping_address":{},"redirect_url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id/checkouts',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "additional_recipients": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "description": "",\n "location_id": ""\n }\n ],\n "ask_for_shipping_address": false,\n "idempotency_key": "",\n "merchant_support_email": "",\n "note": "",\n "order": {\n "idempotency_key": "",\n "order": {\n "closed_at": "",\n "created_at": "",\n "customer_id": "",\n "discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "pricing_rule_id": "",\n "reward_ids": [],\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "fulfillments": [\n {\n "metadata": {},\n "pickup_details": {\n "accepted_at": "",\n "auto_complete_duration": "",\n "cancel_reason": "",\n "canceled_at": "",\n "curbside_pickup_details": {\n "buyer_arrived_at": "",\n "curbside_details": ""\n },\n "expired_at": "",\n "expires_at": "",\n "is_curbside_pickup": false,\n "note": "",\n "picked_up_at": "",\n "pickup_at": "",\n "pickup_window_duration": "",\n "placed_at": "",\n "prep_time_duration": "",\n "ready_at": "",\n "recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "customer_id": "",\n "display_name": "",\n "email_address": "",\n "phone_number": ""\n },\n "rejected_at": "",\n "schedule_type": ""\n },\n "shipment_details": {\n "cancel_reason": "",\n "canceled_at": "",\n "carrier": "",\n "expected_shipped_at": "",\n "failed_at": "",\n "failure_reason": "",\n "in_progress_at": "",\n "packaged_at": "",\n "placed_at": "",\n "recipient": {},\n "shipped_at": "",\n "shipping_note": "",\n "shipping_type": "",\n "tracking_number": "",\n "tracking_url": ""\n },\n "state": "",\n "type": "",\n "uid": ""\n }\n ],\n "id": "",\n "line_items": [\n {\n "applied_discounts": [\n {\n "applied_money": {},\n "discount_uid": "",\n "uid": ""\n }\n ],\n "applied_taxes": [\n {\n "applied_money": {},\n "tax_uid": "",\n "uid": ""\n }\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_sales_money": {},\n "item_type": "",\n "metadata": {},\n "modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "name": "",\n "note": "",\n "pricing_blocklists": {\n "blocked_discounts": [\n {\n "discount_catalog_object_id": "",\n "discount_uid": "",\n "uid": ""\n }\n ],\n "blocked_taxes": [\n {\n "tax_catalog_object_id": "",\n "tax_uid": "",\n "uid": ""\n }\n ]\n },\n "quantity": "",\n "quantity_unit": {\n "catalog_version": 0,\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "location_id": "",\n "metadata": {},\n "net_amounts": {\n "discount_money": {},\n "service_charge_money": {},\n "tax_money": {},\n "tip_money": {},\n "total_money": {}\n },\n "pricing_options": {\n "auto_apply_discounts": false,\n "auto_apply_taxes": false\n },\n "reference_id": "",\n "refunds": [\n {\n "additional_recipients": [\n {\n "amount_money": {},\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "created_at": "",\n "id": "",\n "location_id": "",\n "processing_fee_money": {},\n "reason": "",\n "status": "",\n "tender_id": "",\n "transaction_id": ""\n }\n ],\n "return_amounts": {},\n "returns": [\n {\n "return_amounts": {},\n "return_discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_discount_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "return_line_items": [\n {\n "applied_discounts": [\n {}\n ],\n "applied_taxes": [\n {}\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_return_money": {},\n "item_type": "",\n "name": "",\n "note": "",\n "quantity": "",\n "quantity_unit": {},\n "return_modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "source_modifier_uid": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "source_line_item_uid": "",\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "return_service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "source_service_charge_uid": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "uid": ""\n }\n ],\n "return_taxes": [\n {\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_tax_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "rounding_adjustment": {\n "amount_money": {},\n "name": "",\n "uid": ""\n },\n "source_order_id": "",\n "uid": ""\n }\n ],\n "rewards": [\n {\n "id": "",\n "reward_tier_id": ""\n }\n ],\n "rounding_adjustment": {},\n "service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "type": "",\n "uid": ""\n }\n ],\n "source": {\n "name": ""\n },\n "state": "",\n "taxes": [\n {\n "applied_money": {},\n "auto_applied": false,\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "tenders": [\n {\n "additional_recipients": [\n {}\n ],\n "amount_money": {},\n "card_details": {\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "entry_method": "",\n "status": ""\n },\n "cash_details": {\n "buyer_tendered_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "id": "",\n "location_id": "",\n "note": "",\n "payment_id": "",\n "processing_fee_money": {},\n "tip_money": {},\n "transaction_id": "",\n "type": ""\n }\n ],\n "total_discount_money": {},\n "total_money": {},\n "total_service_charge_money": {},\n "total_tax_money": {},\n "total_tip_money": {},\n "updated_at": "",\n "version": 0\n }\n },\n "pre_populate_buyer_email": "",\n "pre_populate_shipping_address": {},\n "redirect_url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/checkouts")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id/checkouts',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
additional_recipients: [{amount_money: {amount: 0, currency: ''}, description: '', location_id: ''}],
ask_for_shipping_address: false,
idempotency_key: '',
merchant_support_email: '',
note: '',
order: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
},
pre_populate_buyer_email: '',
pre_populate_shipping_address: {},
redirect_url: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/checkouts',
headers: {'content-type': 'application/json'},
body: {
additional_recipients: [{amount_money: {amount: 0, currency: ''}, description: '', location_id: ''}],
ask_for_shipping_address: false,
idempotency_key: '',
merchant_support_email: '',
note: '',
order: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
},
pre_populate_buyer_email: '',
pre_populate_shipping_address: {},
redirect_url: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/locations/:location_id/checkouts');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
additional_recipients: [
{
amount_money: {
amount: 0,
currency: ''
},
description: '',
location_id: ''
}
],
ask_for_shipping_address: false,
idempotency_key: '',
merchant_support_email: '',
note: '',
order: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {
buyer_arrived_at: '',
curbside_details: ''
},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [
{
applied_money: {},
discount_uid: '',
uid: ''
}
],
applied_taxes: [
{
applied_money: {},
tax_uid: '',
uid: ''
}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [
{
discount_catalog_object_id: '',
discount_uid: '',
uid: ''
}
],
blocked_taxes: [
{
tax_catalog_object_id: '',
tax_uid: '',
uid: ''
}
]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {
auto_apply_discounts: false,
auto_apply_taxes: false
},
reference_id: '',
refunds: [
{
additional_recipients: [
{
amount_money: {},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [
{}
],
applied_taxes: [
{}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {
amount_money: {},
name: '',
uid: ''
},
source_order_id: '',
uid: ''
}
],
rewards: [
{
id: '',
reward_tier_id: ''
}
],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {
name: ''
},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [
{}
],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {
buyer_tendered_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
},
pre_populate_buyer_email: '',
pre_populate_shipping_address: {},
redirect_url: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/checkouts',
headers: {'content-type': 'application/json'},
data: {
additional_recipients: [{amount_money: {amount: 0, currency: ''}, description: '', location_id: ''}],
ask_for_shipping_address: false,
idempotency_key: '',
merchant_support_email: '',
note: '',
order: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
},
pre_populate_buyer_email: '',
pre_populate_shipping_address: {},
redirect_url: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id/checkouts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additional_recipients":[{"amount_money":{"amount":0,"currency":""},"description":"","location_id":""}],"ask_for_shipping_address":false,"idempotency_key":"","merchant_support_email":"","note":"","order":{"idempotency_key":"","order":{"closed_at":"","created_at":"","customer_id":"","discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","pricing_rule_id":"","reward_ids":[],"scope":"","type":"","uid":""}],"fulfillments":[{"metadata":{},"pickup_details":{"accepted_at":"","auto_complete_duration":"","cancel_reason":"","canceled_at":"","curbside_pickup_details":{"buyer_arrived_at":"","curbside_details":""},"expired_at":"","expires_at":"","is_curbside_pickup":false,"note":"","picked_up_at":"","pickup_at":"","pickup_window_duration":"","placed_at":"","prep_time_duration":"","ready_at":"","recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"customer_id":"","display_name":"","email_address":"","phone_number":""},"rejected_at":"","schedule_type":""},"shipment_details":{"cancel_reason":"","canceled_at":"","carrier":"","expected_shipped_at":"","failed_at":"","failure_reason":"","in_progress_at":"","packaged_at":"","placed_at":"","recipient":{},"shipped_at":"","shipping_note":"","shipping_type":"","tracking_number":"","tracking_url":""},"state":"","type":"","uid":""}],"id":"","line_items":[{"applied_discounts":[{"applied_money":{},"discount_uid":"","uid":""}],"applied_taxes":[{"applied_money":{},"tax_uid":"","uid":""}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_sales_money":{},"item_type":"","metadata":{},"modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","total_price_money":{},"uid":""}],"name":"","note":"","pricing_blocklists":{"blocked_discounts":[{"discount_catalog_object_id":"","discount_uid":"","uid":""}],"blocked_taxes":[{"tax_catalog_object_id":"","tax_uid":"","uid":""}]},"quantity":"","quantity_unit":{"catalog_version":0,"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"location_id":"","metadata":{},"net_amounts":{"discount_money":{},"service_charge_money":{},"tax_money":{},"tip_money":{},"total_money":{}},"pricing_options":{"auto_apply_discounts":false,"auto_apply_taxes":false},"reference_id":"","refunds":[{"additional_recipients":[{"amount_money":{},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"created_at":"","id":"","location_id":"","processing_fee_money":{},"reason":"","status":"","tender_id":"","transaction_id":""}],"return_amounts":{},"returns":[{"return_amounts":{},"return_discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_discount_uid":"","type":"","uid":""}],"return_line_items":[{"applied_discounts":[{}],"applied_taxes":[{}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_return_money":{},"item_type":"","name":"","note":"","quantity":"","quantity_unit":{},"return_modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","source_modifier_uid":"","total_price_money":{},"uid":""}],"source_line_item_uid":"","total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"return_service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"name":"","percentage":"","source_service_charge_uid":"","taxable":false,"total_money":{},"total_tax_money":{},"uid":""}],"return_taxes":[{"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_tax_uid":"","type":"","uid":""}],"rounding_adjustment":{"amount_money":{},"name":"","uid":""},"source_order_id":"","uid":""}],"rewards":[{"id":"","reward_tier_id":""}],"rounding_adjustment":{},"service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","taxable":false,"total_money":{},"total_tax_money":{},"type":"","uid":""}],"source":{"name":""},"state":"","taxes":[{"applied_money":{},"auto_applied":false,"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","scope":"","type":"","uid":""}],"tenders":[{"additional_recipients":[{}],"amount_money":{},"card_details":{"card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"entry_method":"","status":""},"cash_details":{"buyer_tendered_money":{},"change_back_money":{}},"created_at":"","customer_id":"","id":"","location_id":"","note":"","payment_id":"","processing_fee_money":{},"tip_money":{},"transaction_id":"","type":""}],"total_discount_money":{},"total_money":{},"total_service_charge_money":{},"total_tax_money":{},"total_tip_money":{},"updated_at":"","version":0}},"pre_populate_buyer_email":"","pre_populate_shipping_address":{},"redirect_url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"additional_recipients": @[ @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"description": @"", @"location_id": @"" } ],
@"ask_for_shipping_address": @NO,
@"idempotency_key": @"",
@"merchant_support_email": @"",
@"note": @"",
@"order": @{ @"idempotency_key": @"", @"order": @{ @"closed_at": @"", @"created_at": @"", @"customer_id": @"", @"discounts": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"pricing_rule_id": @"", @"reward_ids": @[ ], @"scope": @"", @"type": @"", @"uid": @"" } ], @"fulfillments": @[ @{ @"metadata": @{ }, @"pickup_details": @{ @"accepted_at": @"", @"auto_complete_duration": @"", @"cancel_reason": @"", @"canceled_at": @"", @"curbside_pickup_details": @{ @"buyer_arrived_at": @"", @"curbside_details": @"" }, @"expired_at": @"", @"expires_at": @"", @"is_curbside_pickup": @NO, @"note": @"", @"picked_up_at": @"", @"pickup_at": @"", @"pickup_window_duration": @"", @"placed_at": @"", @"prep_time_duration": @"", @"ready_at": @"", @"recipient": @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"customer_id": @"", @"display_name": @"", @"email_address": @"", @"phone_number": @"" }, @"rejected_at": @"", @"schedule_type": @"" }, @"shipment_details": @{ @"cancel_reason": @"", @"canceled_at": @"", @"carrier": @"", @"expected_shipped_at": @"", @"failed_at": @"", @"failure_reason": @"", @"in_progress_at": @"", @"packaged_at": @"", @"placed_at": @"", @"recipient": @{ }, @"shipped_at": @"", @"shipping_note": @"", @"shipping_type": @"", @"tracking_number": @"", @"tracking_url": @"" }, @"state": @"", @"type": @"", @"uid": @"" } ], @"id": @"", @"line_items": @[ @{ @"applied_discounts": @[ @{ @"applied_money": @{ }, @"discount_uid": @"", @"uid": @"" } ], @"applied_taxes": @[ @{ @"applied_money": @{ }, @"tax_uid": @"", @"uid": @"" } ], @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"gross_sales_money": @{ }, @"item_type": @"", @"metadata": @{ }, @"modifiers": @[ @{ @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"total_price_money": @{ }, @"uid": @"" } ], @"name": @"", @"note": @"", @"pricing_blocklists": @{ @"blocked_discounts": @[ @{ @"discount_catalog_object_id": @"", @"discount_uid": @"", @"uid": @"" } ], @"blocked_taxes": @[ @{ @"tax_catalog_object_id": @"", @"tax_uid": @"", @"uid": @"" } ] }, @"quantity": @"", @"quantity_unit": @{ @"catalog_version": @0, @"measurement_unit": @{ @"area_unit": @"", @"custom_unit": @{ @"abbreviation": @"", @"name": @"" }, @"generic_unit": @"", @"length_unit": @"", @"time_unit": @"", @"type": @"", @"volume_unit": @"", @"weight_unit": @"" }, @"precision": @0 }, @"total_discount_money": @{ }, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"", @"variation_name": @"", @"variation_total_price_money": @{ } } ], @"location_id": @"", @"metadata": @{ }, @"net_amounts": @{ @"discount_money": @{ }, @"service_charge_money": @{ }, @"tax_money": @{ }, @"tip_money": @{ }, @"total_money": @{ } }, @"pricing_options": @{ @"auto_apply_discounts": @NO, @"auto_apply_taxes": @NO }, @"reference_id": @"", @"refunds": @[ @{ @"additional_recipients": @[ @{ @"amount_money": @{ }, @"description": @"", @"location_id": @"", @"receivable_id": @"" } ], @"amount_money": @{ }, @"created_at": @"", @"id": @"", @"location_id": @"", @"processing_fee_money": @{ }, @"reason": @"", @"status": @"", @"tender_id": @"", @"transaction_id": @"" } ], @"return_amounts": @{ }, @"returns": @[ @{ @"return_amounts": @{ }, @"return_discounts": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"scope": @"", @"source_discount_uid": @"", @"type": @"", @"uid": @"" } ], @"return_line_items": @[ @{ @"applied_discounts": @[ @{ } ], @"applied_taxes": @[ @{ } ], @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"gross_return_money": @{ }, @"item_type": @"", @"name": @"", @"note": @"", @"quantity": @"", @"quantity_unit": @{ }, @"return_modifiers": @[ @{ @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"source_modifier_uid": @"", @"total_price_money": @{ }, @"uid": @"" } ], @"source_line_item_uid": @"", @"total_discount_money": @{ }, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"", @"variation_name": @"", @"variation_total_price_money": @{ } } ], @"return_service_charges": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"applied_taxes": @[ @{ } ], @"calculation_phase": @"", @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"source_service_charge_uid": @"", @"taxable": @NO, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"" } ], @"return_taxes": @[ @{ @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"scope": @"", @"source_tax_uid": @"", @"type": @"", @"uid": @"" } ], @"rounding_adjustment": @{ @"amount_money": @{ }, @"name": @"", @"uid": @"" }, @"source_order_id": @"", @"uid": @"" } ], @"rewards": @[ @{ @"id": @"", @"reward_tier_id": @"" } ], @"rounding_adjustment": @{ }, @"service_charges": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"applied_taxes": @[ @{ } ], @"calculation_phase": @"", @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"taxable": @NO, @"total_money": @{ }, @"total_tax_money": @{ }, @"type": @"", @"uid": @"" } ], @"source": @{ @"name": @"" }, @"state": @"", @"taxes": @[ @{ @"applied_money": @{ }, @"auto_applied": @NO, @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"scope": @"", @"type": @"", @"uid": @"" } ], @"tenders": @[ @{ @"additional_recipients": @[ @{ } ], @"amount_money": @{ }, @"card_details": @{ @"card": @{ @"billing_address": @{ }, @"bin": @"", @"card_brand": @"", @"card_type": @"", @"cardholder_name": @"", @"customer_id": @"", @"enabled": @NO, @"exp_month": @0, @"exp_year": @0, @"fingerprint": @"", @"id": @"", @"last_4": @"", @"prepaid_type": @"", @"reference_id": @"", @"version": @0 }, @"entry_method": @"", @"status": @"" }, @"cash_details": @{ @"buyer_tendered_money": @{ }, @"change_back_money": @{ } }, @"created_at": @"", @"customer_id": @"", @"id": @"", @"location_id": @"", @"note": @"", @"payment_id": @"", @"processing_fee_money": @{ }, @"tip_money": @{ }, @"transaction_id": @"", @"type": @"" } ], @"total_discount_money": @{ }, @"total_money": @{ }, @"total_service_charge_money": @{ }, @"total_tax_money": @{ }, @"total_tip_money": @{ }, @"updated_at": @"", @"version": @0 } },
@"pre_populate_buyer_email": @"",
@"pre_populate_shipping_address": @{ },
@"redirect_url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id/checkouts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id/checkouts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id/checkouts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'additional_recipients' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'description' => '',
'location_id' => ''
]
],
'ask_for_shipping_address' => null,
'idempotency_key' => '',
'merchant_support_email' => '',
'note' => '',
'order' => [
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
],
'pre_populate_buyer_email' => '',
'pre_populate_shipping_address' => [
],
'redirect_url' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/locations/:location_id/checkouts', [
'body' => '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": ""
}
],
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
},
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": {},
"redirect_url": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id/checkouts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'additional_recipients' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'description' => '',
'location_id' => ''
]
],
'ask_for_shipping_address' => null,
'idempotency_key' => '',
'merchant_support_email' => '',
'note' => '',
'order' => [
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
],
'pre_populate_buyer_email' => '',
'pre_populate_shipping_address' => [
],
'redirect_url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'additional_recipients' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'description' => '',
'location_id' => ''
]
],
'ask_for_shipping_address' => null,
'idempotency_key' => '',
'merchant_support_email' => '',
'note' => '',
'order' => [
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
],
'pre_populate_buyer_email' => '',
'pre_populate_shipping_address' => [
],
'redirect_url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/locations/:location_id/checkouts');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id/checkouts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": ""
}
],
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
},
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": {},
"redirect_url": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id/checkouts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": ""
}
],
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
},
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": {},
"redirect_url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/locations/:location_id/checkouts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id/checkouts"
payload = {
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": ""
}
],
"ask_for_shipping_address": False,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": False,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": False,
"auto_apply_taxes": False
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [{}],
"applied_taxes": [{}],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [{}],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": False,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [{}],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": False,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": { "name": "" },
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": False,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [{}],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": False,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
},
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": {},
"redirect_url": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id/checkouts"
payload <- "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id/checkouts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/locations/:location_id/checkouts') do |req|
req.body = "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\"\n }\n ],\n \"ask_for_shipping_address\": false,\n \"idempotency_key\": \"\",\n \"merchant_support_email\": \"\",\n \"note\": \"\",\n \"order\": {\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n },\n \"pre_populate_buyer_email\": \"\",\n \"pre_populate_shipping_address\": {},\n \"redirect_url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id/checkouts";
let payload = json!({
"additional_recipients": (
json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"description": "",
"location_id": ""
})
),
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": json!({
"idempotency_key": "",
"order": json!({
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": (),
"scope": "",
"type": "",
"uid": ""
})
),
"fulfillments": (
json!({
"metadata": json!({}),
"pickup_details": json!({
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": json!({
"buyer_arrived_at": "",
"curbside_details": ""
}),
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
}),
"rejected_at": "",
"schedule_type": ""
}),
"shipment_details": json!({
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": json!({}),
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
}),
"state": "",
"type": "",
"uid": ""
})
),
"id": "",
"line_items": (
json!({
"applied_discounts": (
json!({
"applied_money": json!({}),
"discount_uid": "",
"uid": ""
})
),
"applied_taxes": (
json!({
"applied_money": json!({}),
"tax_uid": "",
"uid": ""
})
),
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": json!({}),
"item_type": "",
"metadata": json!({}),
"modifiers": (
json!({
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": json!({}),
"uid": ""
})
),
"name": "",
"note": "",
"pricing_blocklists": json!({
"blocked_discounts": (
json!({
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
})
),
"blocked_taxes": (
json!({
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
})
)
}),
"quantity": "",
"quantity_unit": json!({
"catalog_version": 0,
"measurement_unit": json!({
"area_unit": "",
"custom_unit": json!({
"abbreviation": "",
"name": ""
}),
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
}),
"precision": 0
}),
"total_discount_money": json!({}),
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": "",
"variation_name": "",
"variation_total_price_money": json!({})
})
),
"location_id": "",
"metadata": json!({}),
"net_amounts": json!({
"discount_money": json!({}),
"service_charge_money": json!({}),
"tax_money": json!({}),
"tip_money": json!({}),
"total_money": json!({})
}),
"pricing_options": json!({
"auto_apply_discounts": false,
"auto_apply_taxes": false
}),
"reference_id": "",
"refunds": (
json!({
"additional_recipients": (
json!({
"amount_money": json!({}),
"description": "",
"location_id": "",
"receivable_id": ""
})
),
"amount_money": json!({}),
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": json!({}),
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
})
),
"return_amounts": json!({}),
"returns": (
json!({
"return_amounts": json!({}),
"return_discounts": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
})
),
"return_line_items": (
json!({
"applied_discounts": (json!({})),
"applied_taxes": (json!({})),
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": json!({}),
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": json!({}),
"return_modifiers": (
json!({
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": json!({}),
"uid": ""
})
),
"source_line_item_uid": "",
"total_discount_money": json!({}),
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": "",
"variation_name": "",
"variation_total_price_money": json!({})
})
),
"return_service_charges": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"applied_taxes": (json!({})),
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": ""
})
),
"return_taxes": (
json!({
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
})
),
"rounding_adjustment": json!({
"amount_money": json!({}),
"name": "",
"uid": ""
}),
"source_order_id": "",
"uid": ""
})
),
"rewards": (
json!({
"id": "",
"reward_tier_id": ""
})
),
"rounding_adjustment": json!({}),
"service_charges": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"applied_taxes": (json!({})),
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"taxable": false,
"total_money": json!({}),
"total_tax_money": json!({}),
"type": "",
"uid": ""
})
),
"source": json!({"name": ""}),
"state": "",
"taxes": (
json!({
"applied_money": json!({}),
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
})
),
"tenders": (
json!({
"additional_recipients": (json!({})),
"amount_money": json!({}),
"card_details": json!({
"card": json!({
"billing_address": json!({}),
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
}),
"entry_method": "",
"status": ""
}),
"cash_details": json!({
"buyer_tendered_money": json!({}),
"change_back_money": json!({})
}),
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": json!({}),
"tip_money": json!({}),
"transaction_id": "",
"type": ""
})
),
"total_discount_money": json!({}),
"total_money": json!({}),
"total_service_charge_money": json!({}),
"total_tax_money": json!({}),
"total_tip_money": json!({}),
"updated_at": "",
"version": 0
})
}),
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": json!({}),
"redirect_url": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/locations/:location_id/checkouts \
--header 'content-type: application/json' \
--data '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": ""
}
],
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
},
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": {},
"redirect_url": ""
}'
echo '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": ""
}
],
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
},
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": {},
"redirect_url": ""
}' | \
http POST {{baseUrl}}/v2/locations/:location_id/checkouts \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "additional_recipients": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "description": "",\n "location_id": ""\n }\n ],\n "ask_for_shipping_address": false,\n "idempotency_key": "",\n "merchant_support_email": "",\n "note": "",\n "order": {\n "idempotency_key": "",\n "order": {\n "closed_at": "",\n "created_at": "",\n "customer_id": "",\n "discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "pricing_rule_id": "",\n "reward_ids": [],\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "fulfillments": [\n {\n "metadata": {},\n "pickup_details": {\n "accepted_at": "",\n "auto_complete_duration": "",\n "cancel_reason": "",\n "canceled_at": "",\n "curbside_pickup_details": {\n "buyer_arrived_at": "",\n "curbside_details": ""\n },\n "expired_at": "",\n "expires_at": "",\n "is_curbside_pickup": false,\n "note": "",\n "picked_up_at": "",\n "pickup_at": "",\n "pickup_window_duration": "",\n "placed_at": "",\n "prep_time_duration": "",\n "ready_at": "",\n "recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "customer_id": "",\n "display_name": "",\n "email_address": "",\n "phone_number": ""\n },\n "rejected_at": "",\n "schedule_type": ""\n },\n "shipment_details": {\n "cancel_reason": "",\n "canceled_at": "",\n "carrier": "",\n "expected_shipped_at": "",\n "failed_at": "",\n "failure_reason": "",\n "in_progress_at": "",\n "packaged_at": "",\n "placed_at": "",\n "recipient": {},\n "shipped_at": "",\n "shipping_note": "",\n "shipping_type": "",\n "tracking_number": "",\n "tracking_url": ""\n },\n "state": "",\n "type": "",\n "uid": ""\n }\n ],\n "id": "",\n "line_items": [\n {\n "applied_discounts": [\n {\n "applied_money": {},\n "discount_uid": "",\n "uid": ""\n }\n ],\n "applied_taxes": [\n {\n "applied_money": {},\n "tax_uid": "",\n "uid": ""\n }\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_sales_money": {},\n "item_type": "",\n "metadata": {},\n "modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "name": "",\n "note": "",\n "pricing_blocklists": {\n "blocked_discounts": [\n {\n "discount_catalog_object_id": "",\n "discount_uid": "",\n "uid": ""\n }\n ],\n "blocked_taxes": [\n {\n "tax_catalog_object_id": "",\n "tax_uid": "",\n "uid": ""\n }\n ]\n },\n "quantity": "",\n "quantity_unit": {\n "catalog_version": 0,\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "location_id": "",\n "metadata": {},\n "net_amounts": {\n "discount_money": {},\n "service_charge_money": {},\n "tax_money": {},\n "tip_money": {},\n "total_money": {}\n },\n "pricing_options": {\n "auto_apply_discounts": false,\n "auto_apply_taxes": false\n },\n "reference_id": "",\n "refunds": [\n {\n "additional_recipients": [\n {\n "amount_money": {},\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "created_at": "",\n "id": "",\n "location_id": "",\n "processing_fee_money": {},\n "reason": "",\n "status": "",\n "tender_id": "",\n "transaction_id": ""\n }\n ],\n "return_amounts": {},\n "returns": [\n {\n "return_amounts": {},\n "return_discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_discount_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "return_line_items": [\n {\n "applied_discounts": [\n {}\n ],\n "applied_taxes": [\n {}\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_return_money": {},\n "item_type": "",\n "name": "",\n "note": "",\n "quantity": "",\n "quantity_unit": {},\n "return_modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "source_modifier_uid": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "source_line_item_uid": "",\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "return_service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "source_service_charge_uid": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "uid": ""\n }\n ],\n "return_taxes": [\n {\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_tax_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "rounding_adjustment": {\n "amount_money": {},\n "name": "",\n "uid": ""\n },\n "source_order_id": "",\n "uid": ""\n }\n ],\n "rewards": [\n {\n "id": "",\n "reward_tier_id": ""\n }\n ],\n "rounding_adjustment": {},\n "service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "type": "",\n "uid": ""\n }\n ],\n "source": {\n "name": ""\n },\n "state": "",\n "taxes": [\n {\n "applied_money": {},\n "auto_applied": false,\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "tenders": [\n {\n "additional_recipients": [\n {}\n ],\n "amount_money": {},\n "card_details": {\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "entry_method": "",\n "status": ""\n },\n "cash_details": {\n "buyer_tendered_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "id": "",\n "location_id": "",\n "note": "",\n "payment_id": "",\n "processing_fee_money": {},\n "tip_money": {},\n "transaction_id": "",\n "type": ""\n }\n ],\n "total_discount_money": {},\n "total_money": {},\n "total_service_charge_money": {},\n "total_tax_money": {},\n "total_tip_money": {},\n "updated_at": "",\n "version": 0\n }\n },\n "pre_populate_buyer_email": "",\n "pre_populate_shipping_address": {},\n "redirect_url": ""\n}' \
--output-document \
- {{baseUrl}}/v2/locations/:location_id/checkouts
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"additional_recipients": [
[
"amount_money": [
"amount": 0,
"currency": ""
],
"description": "",
"location_id": ""
]
],
"ask_for_shipping_address": false,
"idempotency_key": "",
"merchant_support_email": "",
"note": "",
"order": [
"idempotency_key": "",
"order": [
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
[
"amount_money": [],
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
]
],
"fulfillments": [
[
"metadata": [],
"pickup_details": [
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": [
"buyer_arrived_at": "",
"curbside_details": ""
],
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
],
"rejected_at": "",
"schedule_type": ""
],
"shipment_details": [
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": [],
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
],
"state": "",
"type": "",
"uid": ""
]
],
"id": "",
"line_items": [
[
"applied_discounts": [
[
"applied_money": [],
"discount_uid": "",
"uid": ""
]
],
"applied_taxes": [
[
"applied_money": [],
"tax_uid": "",
"uid": ""
]
],
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": [],
"item_type": "",
"metadata": [],
"modifiers": [
[
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": [],
"uid": ""
]
],
"name": "",
"note": "",
"pricing_blocklists": [
"blocked_discounts": [
[
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
]
],
"blocked_taxes": [
[
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
]
]
],
"quantity": "",
"quantity_unit": [
"catalog_version": 0,
"measurement_unit": [
"area_unit": "",
"custom_unit": [
"abbreviation": "",
"name": ""
],
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
],
"precision": 0
],
"total_discount_money": [],
"total_money": [],
"total_tax_money": [],
"uid": "",
"variation_name": "",
"variation_total_price_money": []
]
],
"location_id": "",
"metadata": [],
"net_amounts": [
"discount_money": [],
"service_charge_money": [],
"tax_money": [],
"tip_money": [],
"total_money": []
],
"pricing_options": [
"auto_apply_discounts": false,
"auto_apply_taxes": false
],
"reference_id": "",
"refunds": [
[
"additional_recipients": [
[
"amount_money": [],
"description": "",
"location_id": "",
"receivable_id": ""
]
],
"amount_money": [],
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": [],
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
]
],
"return_amounts": [],
"returns": [
[
"return_amounts": [],
"return_discounts": [
[
"amount_money": [],
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
]
],
"return_line_items": [
[
"applied_discounts": [[]],
"applied_taxes": [[]],
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": [],
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": [],
"return_modifiers": [
[
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": [],
"uid": ""
]
],
"source_line_item_uid": "",
"total_discount_money": [],
"total_money": [],
"total_tax_money": [],
"uid": "",
"variation_name": "",
"variation_total_price_money": []
]
],
"return_service_charges": [
[
"amount_money": [],
"applied_money": [],
"applied_taxes": [[]],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": [],
"total_tax_money": [],
"uid": ""
]
],
"return_taxes": [
[
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
]
],
"rounding_adjustment": [
"amount_money": [],
"name": "",
"uid": ""
],
"source_order_id": "",
"uid": ""
]
],
"rewards": [
[
"id": "",
"reward_tier_id": ""
]
],
"rounding_adjustment": [],
"service_charges": [
[
"amount_money": [],
"applied_money": [],
"applied_taxes": [[]],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"taxable": false,
"total_money": [],
"total_tax_money": [],
"type": "",
"uid": ""
]
],
"source": ["name": ""],
"state": "",
"taxes": [
[
"applied_money": [],
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
]
],
"tenders": [
[
"additional_recipients": [[]],
"amount_money": [],
"card_details": [
"card": [
"billing_address": [],
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
],
"entry_method": "",
"status": ""
],
"cash_details": [
"buyer_tendered_money": [],
"change_back_money": []
],
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": [],
"tip_money": [],
"transaction_id": "",
"type": ""
]
],
"total_discount_money": [],
"total_money": [],
"total_service_charge_money": [],
"total_tax_money": [],
"total_tip_money": [],
"updated_at": "",
"version": 0
]
],
"pre_populate_buyer_email": "",
"pre_populate_shipping_address": [],
"redirect_url": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id/checkouts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"checkout": {
"additional_recipients": [
{
"amount_money": {
"amount": 60,
"currency": "USD"
},
"description": "Application fees",
"location_id": "057P5VYJ4A5X1"
}
],
"ask_for_shipping_address": true,
"checkout_page_url": "https://connect.squareup.com/v2/checkout?c=CAISEHGimXh-C3RIT4og1a6u1qw&l=CYTKRM7R7JMV8",
"created_at": "2017-06-16T22:25:35Z",
"id": "CAISEHGimXh-C3RIT4og1a6u1qw",
"merchant_support_email": "merchant+support@website.com",
"order": {
"customer_id": "customer_id",
"discounts": [
{
"amount_money": {
"amount": 100,
"currency": "USD"
},
"applied_money": {
"amount": 100,
"currency": "USD"
},
"scope": "LINE_ITEM",
"type": "FIXED_AMOUNT",
"uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"
}
],
"line_items": [
{
"applied_discounts": [
{
"applied_money": {
"amount": 100,
"currency": "USD"
},
"discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"
}
],
"applied_taxes": [
{
"applied_money": {
"amount": 103,
"currency": "USD"
},
"tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"
}
],
"base_price_money": {
"amount": 1500,
"currency": "USD"
},
"name": "Printed T Shirt",
"quantity": "2",
"total_discount_money": {
"amount": 100,
"currency": "USD"
},
"total_money": {
"amount": 1503,
"currency": "USD"
},
"total_tax_money": {
"amount": 103,
"currency": "USD"
}
},
{
"base_price_money": {
"amount": 2500,
"currency": "USD"
},
"name": "Slim Jeans",
"quantity": "1",
"total_money": {
"amount": 2500,
"currency": "USD"
}
},
{
"base_price_money": {
"amount": 3500,
"currency": "USD"
},
"name": "Woven Sweater",
"quantity": "3",
"total_money": {
"amount": 10500,
"currency": "USD"
}
}
],
"location_id": "location_id",
"reference_id": "reference_id",
"taxes": [
{
"percentage": "7.75",
"scope": "LINE_ITEM",
"type": "INCLUSIVE",
"uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"
}
],
"total_discount_money": {
"amount": 100,
"currency": "USD"
},
"total_money": {
"amount": 14503,
"currency": "USD"
},
"total_tax_money": {
"amount": 103,
"currency": "USD"
}
},
"pre_populate_buyer_email": "example@email.com",
"pre_populate_shipping_address": {
"address_line_1": "1455 Market St.",
"address_line_2": "Suite 600",
"administrative_district_level_1": "CA",
"country": "US",
"first_name": "Jane",
"last_name": "Doe",
"locality": "San Francisco",
"postal_code": "94103"
},
"redirect_url": "https://merchant.website.com/order-confirm",
"version": 1
}
}
POST
CreateCustomerGroup
{{baseUrl}}/v2/customers/groups
BODY json
{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
},
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/groups");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/customers/groups" {:content-type :json
:form-params {:group {:created_at ""
:id ""
:name ""
:updated_at ""}
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/customers/groups"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/customers/groups"),
Content = new StringContent("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/groups");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/groups"
payload := strings.NewReader("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/customers/groups HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 118
{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
},
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/customers/groups")
.setHeader("content-type", "application/json")
.setBody("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/groups"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/groups")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/customers/groups")
.header("content-type", "application/json")
.body("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
group: {
created_at: '',
id: '',
name: '',
updated_at: ''
},
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/customers/groups');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/groups',
headers: {'content-type': 'application/json'},
data: {group: {created_at: '', id: '', name: '', updated_at: ''}, idempotency_key: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/groups';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"group":{"created_at":"","id":"","name":"","updated_at":""},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/groups',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "group": {\n "created_at": "",\n "id": "",\n "name": "",\n "updated_at": ""\n },\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/groups")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/groups',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({group: {created_at: '', id: '', name: '', updated_at: ''}, idempotency_key: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/groups',
headers: {'content-type': 'application/json'},
body: {group: {created_at: '', id: '', name: '', updated_at: ''}, idempotency_key: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/customers/groups');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
group: {
created_at: '',
id: '',
name: '',
updated_at: ''
},
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/groups',
headers: {'content-type': 'application/json'},
data: {group: {created_at: '', id: '', name: '', updated_at: ''}, idempotency_key: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/groups';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"group":{"created_at":"","id":"","name":"","updated_at":""},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"group": @{ @"created_at": @"", @"id": @"", @"name": @"", @"updated_at": @"" },
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/groups"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/groups" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'group' => [
'created_at' => '',
'id' => '',
'name' => '',
'updated_at' => ''
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/customers/groups', [
'body' => '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
},
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/groups');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'group' => [
'created_at' => '',
'id' => '',
'name' => '',
'updated_at' => ''
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'group' => [
'created_at' => '',
'id' => '',
'name' => '',
'updated_at' => ''
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/customers/groups');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/groups' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
},
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/groups' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
},
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/customers/groups", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/groups"
payload = {
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
},
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/groups"
payload <- "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/groups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/customers/groups') do |req|
req.body = "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/groups";
let payload = json!({
"group": json!({
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
}),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/customers/groups \
--header 'content-type: application/json' \
--data '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
},
"idempotency_key": ""
}'
echo '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
},
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/customers/groups \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "group": {\n "created_at": "",\n "id": "",\n "name": "",\n "updated_at": ""\n },\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/customers/groups
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"group": [
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/groups")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"group": {
"created_at": "2020-04-13T21:54:57.863Z",
"id": "2TAT3CMH4Q0A9M87XJZED0WMR3",
"name": "Loyal Customers",
"updated_at": "2020-04-13T21:54:58Z"
}
}
DELETE
DeleteCustomerGroup
{{baseUrl}}/v2/customers/groups/:group_id
QUERY PARAMS
group_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/groups/:group_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/customers/groups/:group_id")
require "http/client"
url = "{{baseUrl}}/v2/customers/groups/:group_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/customers/groups/:group_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/groups/:group_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/groups/:group_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/customers/groups/:group_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/customers/groups/:group_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/groups/:group_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/groups/:group_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/customers/groups/:group_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/customers/groups/:group_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/groups/:group_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/groups/:group_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/groups/:group_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/groups/:group_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/groups/:group_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/groups/:group_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/customers/groups/:group_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/groups/:group_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/groups/:group_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/groups/:group_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/groups/:group_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/groups/:group_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/customers/groups/:group_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/groups/:group_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/groups/:group_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/groups/:group_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/groups/:group_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/customers/groups/:group_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/groups/:group_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/groups/:group_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/groups/:group_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/customers/groups/:group_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/groups/:group_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/customers/groups/:group_id
http DELETE {{baseUrl}}/v2/customers/groups/:group_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/customers/groups/:group_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/groups/:group_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
GET
ListCustomerGroups
{{baseUrl}}/v2/customers/groups
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/groups");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/customers/groups")
require "http/client"
url = "{{baseUrl}}/v2/customers/groups"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/customers/groups"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/groups");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/groups"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/customers/groups HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/customers/groups")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/groups"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/groups")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/customers/groups")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/customers/groups');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/groups'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/groups';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/groups',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/groups")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/groups',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/groups'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/customers/groups');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/groups'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/groups';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/groups"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/groups" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/groups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/customers/groups');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/groups');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/groups');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/groups' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/groups' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/customers/groups")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/groups"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/groups"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/groups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/customers/groups') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/groups";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/customers/groups
http GET {{baseUrl}}/v2/customers/groups
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/customers/groups
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/groups")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"groups": [
{
"created_at": "2020-04-13T21:54:57.863Z",
"id": "2TAT3CMH4Q0A9M87XJZED0WMR3",
"name": "Loyal Customers",
"updated_at": "2020-04-13T21:54:58Z"
},
{
"created_at": "2020-04-13T21:55:18.795Z",
"id": "4XMEHESXJBNE9S9JAKZD2FGB14",
"name": "Super Loyal Customers",
"updated_at": "2020-04-13T21:55:19Z"
}
]
}
GET
RetrieveCustomerGroup
{{baseUrl}}/v2/customers/groups/:group_id
QUERY PARAMS
group_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/groups/:group_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/customers/groups/:group_id")
require "http/client"
url = "{{baseUrl}}/v2/customers/groups/:group_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/customers/groups/:group_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/groups/:group_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/groups/:group_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/customers/groups/:group_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/customers/groups/:group_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/groups/:group_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/groups/:group_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/customers/groups/:group_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/customers/groups/:group_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/customers/groups/:group_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/groups/:group_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/groups/:group_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/groups/:group_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/groups/:group_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/customers/groups/:group_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/customers/groups/:group_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/customers/groups/:group_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/groups/:group_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/groups/:group_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/groups/:group_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/groups/:group_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/customers/groups/:group_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/groups/:group_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/groups/:group_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/groups/:group_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/groups/:group_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/customers/groups/:group_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/groups/:group_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/groups/:group_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/groups/:group_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/customers/groups/:group_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/groups/:group_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/customers/groups/:group_id
http GET {{baseUrl}}/v2/customers/groups/:group_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/customers/groups/:group_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/groups/:group_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"group": {
"created_at": "2020-04-13T21:54:57.863Z",
"id": "2TAT3CMH4Q0A9M87XJZED0WMR3",
"name": "Loyal Customers",
"updated_at": "2020-04-13T21:54:58Z"
}
}
PUT
UpdateCustomerGroup
{{baseUrl}}/v2/customers/groups/:group_id
QUERY PARAMS
group_id
BODY json
{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/groups/:group_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/customers/groups/:group_id" {:content-type :json
:form-params {:group {:created_at ""
:id ""
:name ""
:updated_at ""}}})
require "http/client"
url = "{{baseUrl}}/v2/customers/groups/:group_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/customers/groups/:group_id"),
Content = new StringContent("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/groups/:group_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/groups/:group_id"
payload := strings.NewReader("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/customers/groups/:group_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 93
{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/customers/groups/:group_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/groups/:group_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/groups/:group_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/customers/groups/:group_id")
.header("content-type", "application/json")
.body("{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
group: {
created_at: '',
id: '',
name: '',
updated_at: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/customers/groups/:group_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/groups/:group_id',
headers: {'content-type': 'application/json'},
data: {group: {created_at: '', id: '', name: '', updated_at: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/groups/:group_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"group":{"created_at":"","id":"","name":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/groups/:group_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "group": {\n "created_at": "",\n "id": "",\n "name": "",\n "updated_at": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/groups/:group_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/groups/:group_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({group: {created_at: '', id: '', name: '', updated_at: ''}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/groups/:group_id',
headers: {'content-type': 'application/json'},
body: {group: {created_at: '', id: '', name: '', updated_at: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/customers/groups/:group_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
group: {
created_at: '',
id: '',
name: '',
updated_at: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/groups/:group_id',
headers: {'content-type': 'application/json'},
data: {group: {created_at: '', id: '', name: '', updated_at: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/groups/:group_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"group":{"created_at":"","id":"","name":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"group": @{ @"created_at": @"", @"id": @"", @"name": @"", @"updated_at": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/groups/:group_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/groups/:group_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/groups/:group_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'group' => [
'created_at' => '',
'id' => '',
'name' => '',
'updated_at' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/customers/groups/:group_id', [
'body' => '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/groups/:group_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'group' => [
'created_at' => '',
'id' => '',
'name' => '',
'updated_at' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'group' => [
'created_at' => '',
'id' => '',
'name' => '',
'updated_at' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/customers/groups/:group_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/groups/:group_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/groups/:group_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/customers/groups/:group_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/groups/:group_id"
payload = { "group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/groups/:group_id"
payload <- "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/groups/:group_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/customers/groups/:group_id') do |req|
req.body = "{\n \"group\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"name\": \"\",\n \"updated_at\": \"\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/groups/:group_id";
let payload = json!({"group": json!({
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/customers/groups/:group_id \
--header 'content-type: application/json' \
--data '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
}
}'
echo '{
"group": {
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
}
}' | \
http PUT {{baseUrl}}/v2/customers/groups/:group_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "group": {\n "created_at": "",\n "id": "",\n "name": "",\n "updated_at": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/customers/groups/:group_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["group": [
"created_at": "",
"id": "",
"name": "",
"updated_at": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/groups/:group_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"group": {
"created_at": "2020-04-13T21:54:57.863Z",
"id": "2TAT3CMH4Q0A9M87XJZED0WMR3",
"name": "Loyal Customers",
"updated_at": "2020-04-13T21:54:58Z"
}
}
PUT
AddGroupToCustomer
{{baseUrl}}/v2/customers/:customer_id/groups/:group_id
QUERY PARAMS
customer_id
group_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
require "http/client"
url = "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"
response = HTTP::Client.put url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id");
var request = new RestRequest("", Method.Put);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/customers/:customer_id/groups/:group_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"))
.method("PUT", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
.put(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id';
const options = {method: 'PUT'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id',
method: 'PUT',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
.put(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/:customer_id/groups/:group_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id';
const options = {method: 'PUT'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id" in
Client.call `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/:customer_id/groups/:group_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
$request->setRequestMethod('PUT');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id' -Method PUT
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id' -Method PUT
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PUT", "/baseUrl/v2/customers/:customer_id/groups/:group_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"
response = requests.put(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"
response <- VERB("PUT", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.put('/baseUrl/v2/customers/:customer_id/groups/:group_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/customers/:customer_id/groups/:group_id
http PUT {{baseUrl}}/v2/customers/:customer_id/groups/:group_id
wget --quiet \
--method PUT \
--output-document \
- {{baseUrl}}/v2/customers/:customer_id/groups/:group_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
POST
CreateCustomer
{{baseUrl}}/v2/customers
BODY json
{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/customers" {:content-type :json
:form-params {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:birthday ""
:company_name ""
:email_address ""
:family_name ""
:given_name ""
:idempotency_key ""
:nickname ""
:note ""
:phone_number ""
:reference_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/customers"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/customers"),
Content = new StringContent("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers"
payload := strings.NewReader("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/customers HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 635
{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/customers")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/customers")
.header("content-type", "application/json")
.body("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
idempotency_key: '',
nickname: '',
note: '',
phone_number: '',
reference_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/customers');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers',
headers: {'content-type': 'application/json'},
data: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
idempotency_key: '',
nickname: '',
note: '',
phone_number: '',
reference_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"birthday":"","company_name":"","email_address":"","family_name":"","given_name":"","idempotency_key":"","nickname":"","note":"","phone_number":"","reference_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "birthday": "",\n "company_name": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "idempotency_key": "",\n "nickname": "",\n "note": "",\n "phone_number": "",\n "reference_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
idempotency_key: '',
nickname: '',
note: '',
phone_number: '',
reference_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers',
headers: {'content-type': 'application/json'},
body: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
idempotency_key: '',
nickname: '',
note: '',
phone_number: '',
reference_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/customers');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
idempotency_key: '',
nickname: '',
note: '',
phone_number: '',
reference_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers',
headers: {'content-type': 'application/json'},
data: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
idempotency_key: '',
nickname: '',
note: '',
phone_number: '',
reference_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"birthday":"","company_name":"","email_address":"","family_name":"","given_name":"","idempotency_key":"","nickname":"","note":"","phone_number":"","reference_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" },
@"birthday": @"",
@"company_name": @"",
@"email_address": @"",
@"family_name": @"",
@"given_name": @"",
@"idempotency_key": @"",
@"nickname": @"",
@"note": @"",
@"phone_number": @"",
@"reference_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'birthday' => '',
'company_name' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'idempotency_key' => '',
'nickname' => '',
'note' => '',
'phone_number' => '',
'reference_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/customers', [
'body' => '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'birthday' => '',
'company_name' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'idempotency_key' => '',
'nickname' => '',
'note' => '',
'phone_number' => '',
'reference_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'birthday' => '',
'company_name' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'idempotency_key' => '',
'nickname' => '',
'note' => '',
'phone_number' => '',
'reference_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/customers');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/customers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers"
payload = {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers"
payload <- "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/customers') do |req|
req.body = "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"idempotency_key\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers";
let payload = json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/customers \
--header 'content-type: application/json' \
--data '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
}'
echo '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
}' | \
http POST {{baseUrl}}/v2/customers \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "birthday": "",\n "company_name": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "idempotency_key": "",\n "nickname": "",\n "note": "",\n "phone_number": "",\n "reference_id": ""\n}' \
--output-document \
- {{baseUrl}}/v2/customers
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"idempotency_key": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"customer": {
"address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"created_at": "2016-03-23T20:21:54.859Z",
"creation_source": "THIRD_PARTY",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"note": "a customer",
"phone_number": "1-212-555-4240",
"preferences": {
"email_unsubscribed": false
},
"reference_id": "YOUR_REFERENCE_ID",
"updated_at": "2016-03-23T20:21:54.859Z",
"version": 0
}
}
POST
CreateCustomerCard
{{baseUrl}}/v2/customers/:customer_id/cards
QUERY PARAMS
customer_id
BODY json
{
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/:customer_id/cards");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/customers/:customer_id/cards" {:content-type :json
:form-params {:billing_address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:card_nonce ""
:cardholder_name ""
:verification_token ""}})
require "http/client"
url = "{{baseUrl}}/v2/customers/:customer_id/cards"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/customers/:customer_id/cards"),
Content = new StringContent("{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/:customer_id/cards");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/:customer_id/cards"
payload := strings.NewReader("{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/customers/:customer_id/cards HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 511
{
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/customers/:customer_id/cards")
.setHeader("content-type", "application/json")
.setBody("{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/:customer_id/cards"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id/cards")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/customers/:customer_id/cards")
.header("content-type", "application/json")
.body("{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}")
.asString();
const data = JSON.stringify({
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
card_nonce: '',
cardholder_name: '',
verification_token: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/customers/:customer_id/cards');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/:customer_id/cards',
headers: {'content-type': 'application/json'},
data: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
card_nonce: '',
cardholder_name: '',
verification_token: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/:customer_id/cards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"card_nonce":"","cardholder_name":"","verification_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/:customer_id/cards',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "card_nonce": "",\n "cardholder_name": "",\n "verification_token": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id/cards")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/:customer_id/cards',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
card_nonce: '',
cardholder_name: '',
verification_token: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/:customer_id/cards',
headers: {'content-type': 'application/json'},
body: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
card_nonce: '',
cardholder_name: '',
verification_token: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/customers/:customer_id/cards');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
card_nonce: '',
cardholder_name: '',
verification_token: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/:customer_id/cards',
headers: {'content-type': 'application/json'},
data: {
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
card_nonce: '',
cardholder_name: '',
verification_token: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/:customer_id/cards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"card_nonce":"","cardholder_name":"","verification_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"billing_address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" },
@"card_nonce": @"",
@"cardholder_name": @"",
@"verification_token": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/:customer_id/cards"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/:customer_id/cards" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/:customer_id/cards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'card_nonce' => '',
'cardholder_name' => '',
'verification_token' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/customers/:customer_id/cards', [
'body' => '{
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/:customer_id/cards');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'card_nonce' => '',
'cardholder_name' => '',
'verification_token' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'card_nonce' => '',
'cardholder_name' => '',
'verification_token' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/customers/:customer_id/cards');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/:customer_id/cards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/:customer_id/cards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/customers/:customer_id/cards", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/:customer_id/cards"
payload = {
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/:customer_id/cards"
payload <- "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/:customer_id/cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/customers/:customer_id/cards') do |req|
req.body = "{\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"card_nonce\": \"\",\n \"cardholder_name\": \"\",\n \"verification_token\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/:customer_id/cards";
let payload = json!({
"billing_address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/customers/:customer_id/cards \
--header 'content-type: application/json' \
--data '{
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
}'
echo '{
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
}' | \
http POST {{baseUrl}}/v2/customers/:customer_id/cards \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "card_nonce": "",\n "cardholder_name": "",\n "verification_token": ""\n}' \
--output-document \
- {{baseUrl}}/v2/customers/:customer_id/cards
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"billing_address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"card_nonce": "",
"cardholder_name": "",
"verification_token": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/:customer_id/cards")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"card": {
"billing_address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"card_brand": "VISA",
"cardholder_name": "Amelia Earhart",
"exp_month": 11,
"exp_year": 2018,
"id": "icard-card_id",
"last_4": "1111"
}
}
DELETE
DeleteCustomer
{{baseUrl}}/v2/customers/:customer_id
QUERY PARAMS
customer_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/:customer_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/customers/:customer_id")
require "http/client"
url = "{{baseUrl}}/v2/customers/:customer_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/customers/:customer_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/:customer_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/:customer_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/customers/:customer_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/customers/:customer_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/:customer_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/customers/:customer_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/customers/:customer_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/customers/:customer_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/:customer_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/:customer_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/:customer_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/customers/:customer_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/customers/:customer_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/customers/:customer_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/:customer_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/:customer_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/:customer_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/:customer_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/customers/:customer_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/:customer_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/:customer_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/:customer_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/:customer_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/customers/:customer_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/:customer_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/:customer_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/:customer_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/customers/:customer_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/:customer_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/customers/:customer_id
http DELETE {{baseUrl}}/v2/customers/:customer_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/customers/:customer_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/:customer_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
DELETE
DeleteCustomerCard
{{baseUrl}}/v2/customers/:customer_id/cards/:card_id
QUERY PARAMS
customer_id
card_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id")
require "http/client"
url = "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/customers/:customer_id/cards/:card_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/:customer_id/cards/:card_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/customers/:customer_id/cards/:card_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/:customer_id/cards/:card_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id/cards/:card_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/customers/:customer_id/cards/:card_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id/cards/:card_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/:customer_id/cards/:card_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/:customer_id/cards/:card_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/:customer_id/cards/:card_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/:customer_id/cards/:card_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/:customer_id/cards/:card_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/:customer_id/cards/:card_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/customers/:customer_id/cards/:card_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/:customer_id/cards/:card_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/customers/:customer_id/cards/:card_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/customers/:customer_id/cards/:card_id
http DELETE {{baseUrl}}/v2/customers/:customer_id/cards/:card_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/customers/:customer_id/cards/:card_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/:customer_id/cards/:card_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
GET
ListCustomers
{{baseUrl}}/v2/customers
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/customers")
require "http/client"
url = "{{baseUrl}}/v2/customers"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/customers"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/customers HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/customers")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/customers")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/customers');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/customers');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/customers');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/customers")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/customers') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/customers
http GET {{baseUrl}}/v2/customers
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/customers
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"customers": [
{
"address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"created_at": "2016-03-23T20:21:54.859Z",
"creation_source": "THIRD_PARTY",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"group_ids": [
"545AXB44B4XXWMVQ4W8SBT3HHF"
],
"id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"note": "a customer",
"phone_number": "1-212-555-4240",
"preferences": {
"email_unsubscribed": false
},
"reference_id": "YOUR_REFERENCE_ID",
"segment_ids": [
"1KB9JE5EGJXCW.REACHABLE"
],
"updated_at": "2016-03-23T20:21:55Z",
"version": 1
}
]
}
DELETE
RemoveGroupFromCustomer
{{baseUrl}}/v2/customers/:customer_id/groups/:group_id
QUERY PARAMS
customer_id
group_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
require "http/client"
url = "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/customers/:customer_id/groups/:group_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/:customer_id/groups/:group_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/:customer_id/groups/:group_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/:customer_id/groups/:group_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/:customer_id/groups/:group_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/customers/:customer_id/groups/:group_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/customers/:customer_id/groups/:group_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/customers/:customer_id/groups/:group_id
http DELETE {{baseUrl}}/v2/customers/:customer_id/groups/:group_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/customers/:customer_id/groups/:group_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/:customer_id/groups/:group_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
GET
RetrieveCustomer
{{baseUrl}}/v2/customers/:customer_id
QUERY PARAMS
customer_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/:customer_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/customers/:customer_id")
require "http/client"
url = "{{baseUrl}}/v2/customers/:customer_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/customers/:customer_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/:customer_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/:customer_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/customers/:customer_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/customers/:customer_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/:customer_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/customers/:customer_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/customers/:customer_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/:customer_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/:customer_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/:customer_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/:customer_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/:customer_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/customers/:customer_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/:customer_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/:customer_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/:customer_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/:customer_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/:customer_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/customers/:customer_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/:customer_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/:customer_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/:customer_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/:customer_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/customers/:customer_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/:customer_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/:customer_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/:customer_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/customers/:customer_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/:customer_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/customers/:customer_id
http GET {{baseUrl}}/v2/customers/:customer_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/customers/:customer_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/:customer_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"customer": {
"address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"created_at": "2016-03-23T20:21:54.859Z",
"creation_source": "THIRD_PARTY",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"group_ids": [
"545AXB44B4XXWMVQ4W8SBT3HHF"
],
"id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"note": "a customer",
"phone_number": "1-212-555-4240",
"preferences": {
"email_unsubscribed": false
},
"reference_id": "YOUR_REFERENCE_ID",
"segment_ids": [
"1KB9JE5EGJXCW.REACHABLE"
],
"updated_at": "2016-03-23T20:21:54.859Z",
"version": 1
}
}
POST
SearchCustomers
{{baseUrl}}/v2/customers/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"creation_source": {
"rule": "",
"values": []
},
"email_address": {
"exact": "",
"fuzzy": ""
},
"group_ids": {
"all": [],
"any": [],
"none": []
},
"phone_number": {},
"reference_id": {},
"updated_at": {}
},
"sort": {
"field": "",
"order": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/customers/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:filter {:created_at {:end_at ""
:start_at ""}
:creation_source {:rule ""
:values []}
:email_address {:exact ""
:fuzzy ""}
:group_ids {:all []
:any []
:none []}
:phone_number {}
:reference_id {}
:updated_at {}}
:sort {:field ""
:order ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/customers/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/customers/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/customers/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 520
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"creation_source": {
"rule": "",
"values": []
},
"email_address": {
"exact": "",
"fuzzy": ""
},
"group_ids": {
"all": [],
"any": [],
"none": []
},
"phone_number": {},
"reference_id": {},
"updated_at": {}
},
"sort": {
"field": "",
"order": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/customers/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/customers/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
created_at: {
end_at: '',
start_at: ''
},
creation_source: {
rule: '',
values: []
},
email_address: {
exact: '',
fuzzy: ''
},
group_ids: {
all: [],
any: [],
none: []
},
phone_number: {},
reference_id: {},
updated_at: {}
},
sort: {
field: '',
order: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/customers/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {
created_at: {end_at: '', start_at: ''},
creation_source: {rule: '', values: []},
email_address: {exact: '', fuzzy: ''},
group_ids: {all: [], any: [], none: []},
phone_number: {},
reference_id: {},
updated_at: {}
},
sort: {field: '', order: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"created_at":{"end_at":"","start_at":""},"creation_source":{"rule":"","values":[]},"email_address":{"exact":"","fuzzy":""},"group_ids":{"all":[],"any":[],"none":[]},"phone_number":{},"reference_id":{},"updated_at":{}},"sort":{"field":"","order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "created_at": {\n "end_at": "",\n "start_at": ""\n },\n "creation_source": {\n "rule": "",\n "values": []\n },\n "email_address": {\n "exact": "",\n "fuzzy": ""\n },\n "group_ids": {\n "all": [],\n "any": [],\n "none": []\n },\n "phone_number": {},\n "reference_id": {},\n "updated_at": {}\n },\n "sort": {\n "field": "",\n "order": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
created_at: {end_at: '', start_at: ''},
creation_source: {rule: '', values: []},
email_address: {exact: '', fuzzy: ''},
group_ids: {all: [], any: [], none: []},
phone_number: {},
reference_id: {},
updated_at: {}
},
sort: {field: '', order: ''}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/search',
headers: {'content-type': 'application/json'},
body: {
cursor: '',
limit: 0,
query: {
filter: {
created_at: {end_at: '', start_at: ''},
creation_source: {rule: '', values: []},
email_address: {exact: '', fuzzy: ''},
group_ids: {all: [], any: [], none: []},
phone_number: {},
reference_id: {},
updated_at: {}
},
sort: {field: '', order: ''}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/customers/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
filter: {
created_at: {
end_at: '',
start_at: ''
},
creation_source: {
rule: '',
values: []
},
email_address: {
exact: '',
fuzzy: ''
},
group_ids: {
all: [],
any: [],
none: []
},
phone_number: {},
reference_id: {},
updated_at: {}
},
sort: {
field: '',
order: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/customers/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {
created_at: {end_at: '', start_at: ''},
creation_source: {rule: '', values: []},
email_address: {exact: '', fuzzy: ''},
group_ids: {all: [], any: [], none: []},
phone_number: {},
reference_id: {},
updated_at: {}
},
sort: {field: '', order: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"created_at":{"end_at":"","start_at":""},"creation_source":{"rule":"","values":[]},"email_address":{"exact":"","fuzzy":""},"group_ids":{"all":[],"any":[],"none":[]},"phone_number":{},"reference_id":{},"updated_at":{}},"sort":{"field":"","order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"filter": @{ @"created_at": @{ @"end_at": @"", @"start_at": @"" }, @"creation_source": @{ @"rule": @"", @"values": @[ ] }, @"email_address": @{ @"exact": @"", @"fuzzy": @"" }, @"group_ids": @{ @"all": @[ ], @"any": @[ ], @"none": @[ ] }, @"phone_number": @{ }, @"reference_id": @{ }, @"updated_at": @{ } }, @"sort": @{ @"field": @"", @"order": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'creation_source' => [
'rule' => '',
'values' => [
]
],
'email_address' => [
'exact' => '',
'fuzzy' => ''
],
'group_ids' => [
'all' => [
],
'any' => [
],
'none' => [
]
],
'phone_number' => [
],
'reference_id' => [
],
'updated_at' => [
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/customers/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"creation_source": {
"rule": "",
"values": []
},
"email_address": {
"exact": "",
"fuzzy": ""
},
"group_ids": {
"all": [],
"any": [],
"none": []
},
"phone_number": {},
"reference_id": {},
"updated_at": {}
},
"sort": {
"field": "",
"order": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'creation_source' => [
'rule' => '',
'values' => [
]
],
'email_address' => [
'exact' => '',
'fuzzy' => ''
],
'group_ids' => [
'all' => [
],
'any' => [
],
'none' => [
]
],
'phone_number' => [
],
'reference_id' => [
],
'updated_at' => [
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'creation_source' => [
'rule' => '',
'values' => [
]
],
'email_address' => [
'exact' => '',
'fuzzy' => ''
],
'group_ids' => [
'all' => [
],
'any' => [
],
'none' => [
]
],
'phone_number' => [
],
'reference_id' => [
],
'updated_at' => [
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/customers/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"creation_source": {
"rule": "",
"values": []
},
"email_address": {
"exact": "",
"fuzzy": ""
},
"group_ids": {
"all": [],
"any": [],
"none": []
},
"phone_number": {},
"reference_id": {},
"updated_at": {}
},
"sort": {
"field": "",
"order": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"creation_source": {
"rule": "",
"values": []
},
"email_address": {
"exact": "",
"fuzzy": ""
},
"group_ids": {
"all": [],
"any": [],
"none": []
},
"phone_number": {},
"reference_id": {},
"updated_at": {}
},
"sort": {
"field": "",
"order": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/customers/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/search"
payload = {
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"creation_source": {
"rule": "",
"values": []
},
"email_address": {
"exact": "",
"fuzzy": ""
},
"group_ids": {
"all": [],
"any": [],
"none": []
},
"phone_number": {},
"reference_id": {},
"updated_at": {}
},
"sort": {
"field": "",
"order": ""
}
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/customers/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"creation_source\": {\n \"rule\": \"\",\n \"values\": []\n },\n \"email_address\": {\n \"exact\": \"\",\n \"fuzzy\": \"\"\n },\n \"group_ids\": {\n \"all\": [],\n \"any\": [],\n \"none\": []\n },\n \"phone_number\": {},\n \"reference_id\": {},\n \"updated_at\": {}\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({
"filter": json!({
"created_at": json!({
"end_at": "",
"start_at": ""
}),
"creation_source": json!({
"rule": "",
"values": ()
}),
"email_address": json!({
"exact": "",
"fuzzy": ""
}),
"group_ids": json!({
"all": (),
"any": (),
"none": ()
}),
"phone_number": json!({}),
"reference_id": json!({}),
"updated_at": json!({})
}),
"sort": json!({
"field": "",
"order": ""
})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/customers/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"creation_source": {
"rule": "",
"values": []
},
"email_address": {
"exact": "",
"fuzzy": ""
},
"group_ids": {
"all": [],
"any": [],
"none": []
},
"phone_number": {},
"reference_id": {},
"updated_at": {}
},
"sort": {
"field": "",
"order": ""
}
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"creation_source": {
"rule": "",
"values": []
},
"email_address": {
"exact": "",
"fuzzy": ""
},
"group_ids": {
"all": [],
"any": [],
"none": []
},
"phone_number": {},
"reference_id": {},
"updated_at": {}
},
"sort": {
"field": "",
"order": ""
}
}
}' | \
http POST {{baseUrl}}/v2/customers/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "created_at": {\n "end_at": "",\n "start_at": ""\n },\n "creation_source": {\n "rule": "",\n "values": []\n },\n "email_address": {\n "exact": "",\n "fuzzy": ""\n },\n "group_ids": {\n "all": [],\n "any": [],\n "none": []\n },\n "phone_number": {},\n "reference_id": {},\n "updated_at": {}\n },\n "sort": {\n "field": "",\n "order": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/customers/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": [
"filter": [
"created_at": [
"end_at": "",
"start_at": ""
],
"creation_source": [
"rule": "",
"values": []
],
"email_address": [
"exact": "",
"fuzzy": ""
],
"group_ids": [
"all": [],
"any": [],
"none": []
],
"phone_number": [],
"reference_id": [],
"updated_at": []
],
"sort": [
"field": "",
"order": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "9dpS093Uy12AzeE",
"customers": [
{
"address": {
"address_line_1": "505 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"created_at": "2018-01-23T20:21:54.859Z",
"creation_source": "DIRECTORY",
"email_address": "james.bond@example.com",
"family_name": "Bond",
"given_name": "James",
"group_ids": [
"545AXB44B4XXWMVQ4W8SBT3HHF"
],
"id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"phone_number": "1-212-555-4250",
"preferences": {
"email_unsubscribed": false
},
"reference_id": "YOUR_REFERENCE_ID_2",
"segment_ids": [
"1KB9JE5EGJXCW.REACHABLE"
],
"updated_at": "2020-04-20T10:02:43.083Z",
"version": 7
},
{
"address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"created_at": "2018-01-30T14:10:54.859Z",
"creation_source": "THIRD_PARTY",
"email_address": "amelia.earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"group_ids": [
"545AXB44B4XXWMVQ4W8SBT3HHF"
],
"id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"note": "a customer",
"phone_number": "1-212-555-4240",
"preferences": {
"email_unsubscribed": false
},
"reference_id": "YOUR_REFERENCE_ID_1",
"segment_ids": [
"1KB9JE5EGJXCW.REACHABLE"
],
"updated_at": "2018-03-08T18:25:21.342Z",
"version": 1
}
]
}
PUT
UpdateCustomer
{{baseUrl}}/v2/customers/:customer_id
QUERY PARAMS
customer_id
BODY json
{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/:customer_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/customers/:customer_id" {:content-type :json
:form-params {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:birthday ""
:company_name ""
:email_address ""
:family_name ""
:given_name ""
:nickname ""
:note ""
:phone_number ""
:reference_id ""
:version 0}})
require "http/client"
url = "{{baseUrl}}/v2/customers/:customer_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/customers/:customer_id"),
Content = new StringContent("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/:customer_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/:customer_id"
payload := strings.NewReader("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/customers/:customer_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 626
{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/customers/:customer_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/:customer_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/customers/:customer_id")
.header("content-type", "application/json")
.body("{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}")
.asString();
const data = JSON.stringify({
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
nickname: '',
note: '',
phone_number: '',
reference_id: '',
version: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/customers/:customer_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/:customer_id',
headers: {'content-type': 'application/json'},
data: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
nickname: '',
note: '',
phone_number: '',
reference_id: '',
version: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/:customer_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"birthday":"","company_name":"","email_address":"","family_name":"","given_name":"","nickname":"","note":"","phone_number":"","reference_id":"","version":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/:customer_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "birthday": "",\n "company_name": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "nickname": "",\n "note": "",\n "phone_number": "",\n "reference_id": "",\n "version": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/:customer_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/:customer_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
nickname: '',
note: '',
phone_number: '',
reference_id: '',
version: 0
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/:customer_id',
headers: {'content-type': 'application/json'},
body: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
nickname: '',
note: '',
phone_number: '',
reference_id: '',
version: 0
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/customers/:customer_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
nickname: '',
note: '',
phone_number: '',
reference_id: '',
version: 0
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/customers/:customer_id',
headers: {'content-type': 'application/json'},
data: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
birthday: '',
company_name: '',
email_address: '',
family_name: '',
given_name: '',
nickname: '',
note: '',
phone_number: '',
reference_id: '',
version: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/:customer_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"birthday":"","company_name":"","email_address":"","family_name":"","given_name":"","nickname":"","note":"","phone_number":"","reference_id":"","version":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" },
@"birthday": @"",
@"company_name": @"",
@"email_address": @"",
@"family_name": @"",
@"given_name": @"",
@"nickname": @"",
@"note": @"",
@"phone_number": @"",
@"reference_id": @"",
@"version": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/:customer_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/:customer_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/:customer_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'birthday' => '',
'company_name' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'nickname' => '',
'note' => '',
'phone_number' => '',
'reference_id' => '',
'version' => 0
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/customers/:customer_id', [
'body' => '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/:customer_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'birthday' => '',
'company_name' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'nickname' => '',
'note' => '',
'phone_number' => '',
'reference_id' => '',
'version' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'birthday' => '',
'company_name' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'nickname' => '',
'note' => '',
'phone_number' => '',
'reference_id' => '',
'version' => 0
]));
$request->setRequestUrl('{{baseUrl}}/v2/customers/:customer_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/:customer_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/:customer_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/customers/:customer_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/:customer_id"
payload = {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/:customer_id"
payload <- "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/:customer_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/customers/:customer_id') do |req|
req.body = "{\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"birthday\": \"\",\n \"company_name\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"nickname\": \"\",\n \"note\": \"\",\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/:customer_id";
let payload = json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/customers/:customer_id \
--header 'content-type: application/json' \
--data '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
}'
echo '{
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
}' | \
http PUT {{baseUrl}}/v2/customers/:customer_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "birthday": "",\n "company_name": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "nickname": "",\n "note": "",\n "phone_number": "",\n "reference_id": "",\n "version": 0\n}' \
--output-document \
- {{baseUrl}}/v2/customers/:customer_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"birthday": "",
"company_name": "",
"email_address": "",
"family_name": "",
"given_name": "",
"nickname": "",
"note": "",
"phone_number": "",
"reference_id": "",
"version": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/:customer_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"customer": {
"address": {
"address_line_1": "500 Electric Ave",
"address_line_2": "Suite 600",
"administrative_district_level_1": "NY",
"country": "US",
"locality": "New York",
"postal_code": "10003"
},
"created_at": "2016-03-23T20:21:54.859Z",
"creation_source": "THIRD_PARTY",
"email_address": "New.Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"note": "updated customer note",
"preferences": {
"email_unsubscribed": false
},
"reference_id": "YOUR_REFERENCE_ID",
"updated_at": "2016-05-15T20:21:55Z",
"version": 3
}
}
GET
ListCustomerSegments
{{baseUrl}}/v2/customers/segments
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/segments");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/customers/segments")
require "http/client"
url = "{{baseUrl}}/v2/customers/segments"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/customers/segments"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/segments");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/segments"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/customers/segments HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/customers/segments")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/segments"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/segments")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/customers/segments")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/customers/segments');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/segments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/segments';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/segments',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/segments")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/segments',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/segments'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/customers/segments');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/customers/segments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/segments';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/segments"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/segments" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/segments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/customers/segments');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/segments');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/segments');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/segments' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/segments' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/customers/segments")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/segments"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/segments"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/segments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/customers/segments') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/segments";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/customers/segments
http GET {{baseUrl}}/v2/customers/segments
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/customers/segments
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/segments")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"segments": [
{
"created_at": "2020-01-09T19:33:24.469Z",
"id": "GMNXRZVEXNQDF.CHURN_RISK",
"name": "Lapsed",
"updated_at": "2020-04-13T21:47:04Z"
},
{
"created_at": "2020-01-09T19:33:24.486Z",
"id": "GMNXRZVEXNQDF.LOYAL",
"name": "Regulars",
"updated_at": "2020-04-13T21:47:04Z"
},
{
"created_at": "2020-01-09T19:33:21.813Z",
"id": "GMNXRZVEXNQDF.REACHABLE",
"name": "Reachable",
"updated_at": "2020-04-13T21:47:04Z"
},
{
"created_at": "2020-01-09T19:33:25Z",
"id": "gv2:KF92J19VXN5FK30GX2E8HSGQ20",
"name": "Instant Profile",
"updated_at": "2020-04-13T23:01:03Z"
}
]
}
GET
RetrieveCustomerSegment
{{baseUrl}}/v2/customers/segments/:segment_id
QUERY PARAMS
segment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/customers/segments/:segment_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/customers/segments/:segment_id")
require "http/client"
url = "{{baseUrl}}/v2/customers/segments/:segment_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/customers/segments/:segment_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/customers/segments/:segment_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/customers/segments/:segment_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/customers/segments/:segment_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/customers/segments/:segment_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/customers/segments/:segment_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/customers/segments/:segment_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/customers/segments/:segment_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/customers/segments/:segment_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/customers/segments/:segment_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/customers/segments/:segment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/customers/segments/:segment_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/customers/segments/:segment_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/customers/segments/:segment_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/customers/segments/:segment_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/customers/segments/:segment_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/customers/segments/:segment_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/customers/segments/:segment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/customers/segments/:segment_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/customers/segments/:segment_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/customers/segments/:segment_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/customers/segments/:segment_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/customers/segments/:segment_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/customers/segments/:segment_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/customers/segments/:segment_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/customers/segments/:segment_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/customers/segments/:segment_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/customers/segments/:segment_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/customers/segments/:segment_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/customers/segments/:segment_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/customers/segments/:segment_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/customers/segments/:segment_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/customers/segments/:segment_id
http GET {{baseUrl}}/v2/customers/segments/:segment_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/customers/segments/:segment_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/customers/segments/:segment_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"segment": {
"created_at": "2020-01-09T19:33:24.469Z",
"id": "GMNXRZVEXNQDF.CHURN_RISK",
"name": "Lapsed",
"updated_at": "2020-04-13T23:01:13Z"
}
}
POST
CreateDeviceCode
{{baseUrl}}/v2/devices/codes
BODY json
{
"device_code": {
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
},
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/devices/codes");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/devices/codes" {:content-type :json
:form-params {:device_code {:code ""
:created_at ""
:device_id ""
:id ""
:location_id ""
:name ""
:pair_by ""
:paired_at ""
:product_type ""
:status ""
:status_changed_at ""}
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/devices/codes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/devices/codes"),
Content = new StringContent("{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/devices/codes");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/devices/codes"
payload := strings.NewReader("{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/devices/codes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"device_code": {
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
},
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/devices/codes")
.setHeader("content-type", "application/json")
.setBody("{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/devices/codes"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/devices/codes")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/devices/codes")
.header("content-type", "application/json")
.body("{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
device_code: {
code: '',
created_at: '',
device_id: '',
id: '',
location_id: '',
name: '',
pair_by: '',
paired_at: '',
product_type: '',
status: '',
status_changed_at: ''
},
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/devices/codes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/devices/codes',
headers: {'content-type': 'application/json'},
data: {
device_code: {
code: '',
created_at: '',
device_id: '',
id: '',
location_id: '',
name: '',
pair_by: '',
paired_at: '',
product_type: '',
status: '',
status_changed_at: ''
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/devices/codes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_code":{"code":"","created_at":"","device_id":"","id":"","location_id":"","name":"","pair_by":"","paired_at":"","product_type":"","status":"","status_changed_at":""},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/devices/codes',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "device_code": {\n "code": "",\n "created_at": "",\n "device_id": "",\n "id": "",\n "location_id": "",\n "name": "",\n "pair_by": "",\n "paired_at": "",\n "product_type": "",\n "status": "",\n "status_changed_at": ""\n },\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/devices/codes")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/devices/codes',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
device_code: {
code: '',
created_at: '',
device_id: '',
id: '',
location_id: '',
name: '',
pair_by: '',
paired_at: '',
product_type: '',
status: '',
status_changed_at: ''
},
idempotency_key: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/devices/codes',
headers: {'content-type': 'application/json'},
body: {
device_code: {
code: '',
created_at: '',
device_id: '',
id: '',
location_id: '',
name: '',
pair_by: '',
paired_at: '',
product_type: '',
status: '',
status_changed_at: ''
},
idempotency_key: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/devices/codes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
device_code: {
code: '',
created_at: '',
device_id: '',
id: '',
location_id: '',
name: '',
pair_by: '',
paired_at: '',
product_type: '',
status: '',
status_changed_at: ''
},
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/devices/codes',
headers: {'content-type': 'application/json'},
data: {
device_code: {
code: '',
created_at: '',
device_id: '',
id: '',
location_id: '',
name: '',
pair_by: '',
paired_at: '',
product_type: '',
status: '',
status_changed_at: ''
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/devices/codes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"device_code":{"code":"","created_at":"","device_id":"","id":"","location_id":"","name":"","pair_by":"","paired_at":"","product_type":"","status":"","status_changed_at":""},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"device_code": @{ @"code": @"", @"created_at": @"", @"device_id": @"", @"id": @"", @"location_id": @"", @"name": @"", @"pair_by": @"", @"paired_at": @"", @"product_type": @"", @"status": @"", @"status_changed_at": @"" },
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/devices/codes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/devices/codes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/devices/codes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'device_code' => [
'code' => '',
'created_at' => '',
'device_id' => '',
'id' => '',
'location_id' => '',
'name' => '',
'pair_by' => '',
'paired_at' => '',
'product_type' => '',
'status' => '',
'status_changed_at' => ''
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/devices/codes', [
'body' => '{
"device_code": {
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
},
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/devices/codes');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'device_code' => [
'code' => '',
'created_at' => '',
'device_id' => '',
'id' => '',
'location_id' => '',
'name' => '',
'pair_by' => '',
'paired_at' => '',
'product_type' => '',
'status' => '',
'status_changed_at' => ''
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'device_code' => [
'code' => '',
'created_at' => '',
'device_id' => '',
'id' => '',
'location_id' => '',
'name' => '',
'pair_by' => '',
'paired_at' => '',
'product_type' => '',
'status' => '',
'status_changed_at' => ''
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/devices/codes');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/devices/codes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_code": {
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
},
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/devices/codes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"device_code": {
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
},
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/devices/codes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/devices/codes"
payload = {
"device_code": {
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
},
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/devices/codes"
payload <- "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/devices/codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/devices/codes') do |req|
req.body = "{\n \"device_code\": {\n \"code\": \"\",\n \"created_at\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"name\": \"\",\n \"pair_by\": \"\",\n \"paired_at\": \"\",\n \"product_type\": \"\",\n \"status\": \"\",\n \"status_changed_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/devices/codes";
let payload = json!({
"device_code": json!({
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
}),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/devices/codes \
--header 'content-type: application/json' \
--data '{
"device_code": {
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
},
"idempotency_key": ""
}'
echo '{
"device_code": {
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
},
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/devices/codes \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "device_code": {\n "code": "",\n "created_at": "",\n "device_id": "",\n "id": "",\n "location_id": "",\n "name": "",\n "pair_by": "",\n "paired_at": "",\n "product_type": "",\n "status": "",\n "status_changed_at": ""\n },\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/devices/codes
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"device_code": [
"code": "",
"created_at": "",
"device_id": "",
"id": "",
"location_id": "",
"name": "",
"pair_by": "",
"paired_at": "",
"product_type": "",
"status": "",
"status_changed_at": ""
],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/devices/codes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"device_code": {
"code": "EBCARJ",
"created_at": "2020-02-06T18:44:33.000Z",
"id": "B3Z6NAMYQSMTM",
"location_id": "B5E4484SHHNYH",
"name": "Counter 1",
"pair_by": "2020-02-06T18:49:33.000Z",
"product_type": "TERMINAL_API",
"status": "UNPAIRED",
"status_changed_at": "2020-02-06T18:44:33.000Z"
}
}
GET
GetDeviceCode
{{baseUrl}}/v2/devices/codes/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/devices/codes/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/devices/codes/:id")
require "http/client"
url = "{{baseUrl}}/v2/devices/codes/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/devices/codes/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/devices/codes/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/devices/codes/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/devices/codes/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/devices/codes/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/devices/codes/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/devices/codes/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/devices/codes/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/devices/codes/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/devices/codes/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/devices/codes/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/devices/codes/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/devices/codes/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/devices/codes/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/devices/codes/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/devices/codes/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/devices/codes/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/devices/codes/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/devices/codes/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/devices/codes/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/devices/codes/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/devices/codes/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/devices/codes/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/devices/codes/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/devices/codes/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/devices/codes/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/devices/codes/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/devices/codes/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/devices/codes/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/devices/codes/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/devices/codes/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/devices/codes/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/devices/codes/:id
http GET {{baseUrl}}/v2/devices/codes/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/devices/codes/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/devices/codes/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"device_code": {
"code": "EBCARJ",
"created_at": "2020-02-06T18:44:33.000Z",
"device_id": "907CS13101300122",
"id": "B3Z6NAMYQSMTM",
"location_id": "B5E4484SHHNYH",
"name": "Counter 1",
"pair_by": "2020-02-06T18:49:33.000Z",
"product_type": "TERMINAL_API",
"status": "PAIRED",
"status_changed_at": "2020-02-06T18:47:28.000Z"
}
}
GET
ListDeviceCodes
{{baseUrl}}/v2/devices/codes
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/devices/codes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/devices/codes")
require "http/client"
url = "{{baseUrl}}/v2/devices/codes"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/devices/codes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/devices/codes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/devices/codes"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/devices/codes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/devices/codes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/devices/codes"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/devices/codes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/devices/codes")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/devices/codes');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/devices/codes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/devices/codes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/devices/codes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/devices/codes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/devices/codes',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/devices/codes'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/devices/codes');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/devices/codes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/devices/codes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/devices/codes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/devices/codes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/devices/codes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/devices/codes');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/devices/codes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/devices/codes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/devices/codes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/devices/codes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/devices/codes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/devices/codes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/devices/codes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/devices/codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/devices/codes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/devices/codes";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/devices/codes
http GET {{baseUrl}}/v2/devices/codes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/devices/codes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/devices/codes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"device_codes": [
{
"code": "EBCARJ",
"created_at": "2020-02-06T18:44:33.000Z",
"device_id": "907CS13101300122",
"id": "B3Z6NAMYQSMTM",
"location_id": "B5E4484SHHNYH",
"name": "Counter 1",
"pair_by": "2020-02-06T18:49:33.000Z",
"product_type": "TERMINAL_API",
"status": "PAIRED",
"status_changed_at": "2020-02-06T18:47:28.000Z"
},
{
"code": "GVXNYN",
"created_at": "2020-02-07T19:55:04.000Z",
"id": "YKGMJMYK8H4PQ",
"location_id": "A6SYFRSV4WAFW",
"name": "Unused device code",
"pair_by": "2020-02-07T20:00:04.000Z",
"product_type": "TERMINAL_API",
"status": "UNPAIRED",
"status_changed_at": "2020-02-07T19:55:04.000Z"
}
]
}
POST
AcceptDispute
{{baseUrl}}/v2/disputes/:dispute_id/accept
QUERY PARAMS
dispute_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/disputes/:dispute_id/accept");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/disputes/:dispute_id/accept")
require "http/client"
url = "{{baseUrl}}/v2/disputes/:dispute_id/accept"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/disputes/:dispute_id/accept"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/disputes/:dispute_id/accept");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/disputes/:dispute_id/accept"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/disputes/:dispute_id/accept HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/disputes/:dispute_id/accept")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/disputes/:dispute_id/accept"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/accept")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/disputes/:dispute_id/accept")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/disputes/:dispute_id/accept');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/accept'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/disputes/:dispute_id/accept';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/disputes/:dispute_id/accept',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/accept")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/disputes/:dispute_id/accept',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/accept'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/disputes/:dispute_id/accept');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/accept'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/disputes/:dispute_id/accept';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/disputes/:dispute_id/accept"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/disputes/:dispute_id/accept" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/disputes/:dispute_id/accept",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/disputes/:dispute_id/accept');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/disputes/:dispute_id/accept');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/disputes/:dispute_id/accept');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/disputes/:dispute_id/accept' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/disputes/:dispute_id/accept' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/disputes/:dispute_id/accept")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/disputes/:dispute_id/accept"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/disputes/:dispute_id/accept"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/disputes/:dispute_id/accept")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/disputes/:dispute_id/accept') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/disputes/:dispute_id/accept";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/disputes/:dispute_id/accept
http POST {{baseUrl}}/v2/disputes/:dispute_id/accept
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/disputes/:dispute_id/accept
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/disputes/:dispute_id/accept")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"dispute": {
"amount_money": {
"amount": 2000,
"currency": "USD"
},
"brand_dispute_id": "100000282394",
"card_brand": "VISA",
"created_at": "2018-10-18T15:59:13.613Z",
"disputed_payments": [
{
"payment_id": "6Ee10wvqhfipStz297mtUhBXvaB"
}
],
"due_at": "2018-11-01T00:00:00.000Z",
"id": "XDgyFu7yo1E2S5lQGGpYn",
"reason": "NO_KNOWLEDGE",
"state": "LOST",
"updated_at": "2018-10-18T15:59:13.613Z"
}
}
POST
CreateDisputeEvidenceText
{{baseUrl}}/v2/disputes/:dispute_id/evidence-text
QUERY PARAMS
dispute_id
BODY json
{
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text" {:content-type :json
:form-params {:evidence_text ""
:evidence_type ""
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/disputes/:dispute_id/evidence-text"),
Content = new StringContent("{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/disputes/:dispute_id/evidence-text");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text"
payload := strings.NewReader("{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/disputes/:dispute_id/evidence-text HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 73
{
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text")
.setHeader("content-type", "application/json")
.setBody("{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/disputes/:dispute_id/evidence-text"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/evidence-text")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/disputes/:dispute_id/evidence-text")
.header("content-type", "application/json")
.body("{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
evidence_text: '',
evidence_type: '',
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text',
headers: {'content-type': 'application/json'},
data: {evidence_text: '', evidence_type: '', idempotency_key: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"evidence_text":"","evidence_type":"","idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "evidence_text": "",\n "evidence_type": "",\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/evidence-text")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/disputes/:dispute_id/evidence-text',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({evidence_text: '', evidence_type: '', idempotency_key: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text',
headers: {'content-type': 'application/json'},
body: {evidence_text: '', evidence_type: '', idempotency_key: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
evidence_text: '',
evidence_type: '',
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text',
headers: {'content-type': 'application/json'},
data: {evidence_text: '', evidence_type: '', idempotency_key: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"evidence_text":"","evidence_type":"","idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"evidence_text": @"",
@"evidence_type": @"",
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/disputes/:dispute_id/evidence-text"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/disputes/:dispute_id/evidence-text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'evidence_text' => '',
'evidence_type' => '',
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text', [
'body' => '{
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/disputes/:dispute_id/evidence-text');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'evidence_text' => '',
'evidence_type' => '',
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'evidence_text' => '',
'evidence_type' => '',
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/disputes/:dispute_id/evidence-text');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/disputes/:dispute_id/evidence-text' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/disputes/:dispute_id/evidence-text", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text"
payload = {
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text"
payload <- "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/disputes/:dispute_id/evidence-text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/disputes/:dispute_id/evidence-text') do |req|
req.body = "{\n \"evidence_text\": \"\",\n \"evidence_type\": \"\",\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text";
let payload = json!({
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/disputes/:dispute_id/evidence-text \
--header 'content-type: application/json' \
--data '{
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
}'
echo '{
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/disputes/:dispute_id/evidence-text \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "evidence_text": "",\n "evidence_type": "",\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/disputes/:dispute_id/evidence-text
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"evidence_text": "",
"evidence_type": "",
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/disputes/:dispute_id/evidence-text")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"evidence": {
"dispute_id": "bVTprrwk0gygTLZ96VX1oB",
"evidence_text": "1Z8888888888888888",
"evidence_type": "TRACKING_NUMBER",
"id": "TOomLInj6iWmP3N8qfCXrB",
"uploaded_at": "2018-10-18T16:01:10.000Z"
}
}
DELETE
DeleteDisputeEvidence
{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id
QUERY PARAMS
dispute_id
evidence_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
require "http/client"
url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/disputes/:dispute_id/evidence/:evidence_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/disputes/:dispute_id/evidence/:evidence_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/disputes/:dispute_id/evidence/:evidence_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/disputes/:dispute_id/evidence/:evidence_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id
http DELETE {{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
GET
ListDisputeEvidence
{{baseUrl}}/v2/disputes/:dispute_id/evidence
QUERY PARAMS
dispute_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/disputes/:dispute_id/evidence");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/disputes/:dispute_id/evidence")
require "http/client"
url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/disputes/:dispute_id/evidence"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/disputes/:dispute_id/evidence");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/disputes/:dispute_id/evidence"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/disputes/:dispute_id/evidence HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/disputes/:dispute_id/evidence")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/disputes/:dispute_id/evidence"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/evidence")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/disputes/:dispute_id/evidence")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/disputes/:dispute_id/evidence');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/disputes/:dispute_id/evidence';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/evidence")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/disputes/:dispute_id/evidence',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/disputes/:dispute_id/evidence');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/disputes/:dispute_id/evidence';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/disputes/:dispute_id/evidence"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/disputes/:dispute_id/evidence" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/disputes/:dispute_id/evidence",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/disputes/:dispute_id/evidence');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/disputes/:dispute_id/evidence');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/disputes/:dispute_id/evidence');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/disputes/:dispute_id/evidence' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/disputes/:dispute_id/evidence' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/disputes/:dispute_id/evidence")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/disputes/:dispute_id/evidence"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/disputes/:dispute_id/evidence")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/disputes/:dispute_id/evidence') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/disputes/:dispute_id/evidence
http GET {{baseUrl}}/v2/disputes/:dispute_id/evidence
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/disputes/:dispute_id/evidence
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/disputes/:dispute_id/evidence")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "G1aSTRm48CLjJsg6Sg3hQN1b1OMaoVuG",
"evidence": [
{
"dispute_id": "bVTprrwk0gygTLZ96VX1oB",
"evidence_text": "1Z8888888888888888",
"evidence_type": "TRACKING_NUMBER",
"id": "TOomLInj6iWmP3N8qfCXrB",
"uploaded_at": "2018-10-18T16:01:10.000Z"
},
{
"dispute_id": "bVTprrwk0gygTLZ96VX1oB",
"evidence_file": {
"filename": "evidence.tiff",
"filetype": "image/tiff"
},
"evidence_id": "TOomLInj6iWmP3N8qfCXrB",
"evidence_type": "GENERIC_EVIDENCE",
"uploaded_at": "2018-10-18T16:01:10.000Z"
}
]
}
GET
ListDisputes
{{baseUrl}}/v2/disputes
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/disputes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/disputes")
require "http/client"
url = "{{baseUrl}}/v2/disputes"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/disputes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/disputes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/disputes"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/disputes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/disputes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/disputes"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/disputes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/disputes")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/disputes');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/disputes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/disputes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/disputes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/disputes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/disputes',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/disputes'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/disputes');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/disputes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/disputes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/disputes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/disputes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/disputes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/disputes');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/disputes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/disputes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/disputes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/disputes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/disputes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/disputes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/disputes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/disputes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/disputes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/disputes";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/disputes
http GET {{baseUrl}}/v2/disputes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/disputes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/disputes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "G1aSTRm48CLjJsg6Sg3hQN1b1OMaoVuG",
"disputes": [
{
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"brand_dispute_id": "100000809947",
"card_brand": "VISA",
"created_at": "2018-10-12T02:20:25.577Z",
"disputed_payments": [
{
"payment_id": "APgIq6RX2jM6DKDhMHiC6QEkuaB"
}
],
"due_at": "2018-10-11T00:00:00.000Z",
"id": "OnY1AZwhSi775rbNIK4gv",
"reason": "NO_KNOWLEDGE",
"state": "EVIDENCE_REQUIRED",
"updated_at": "2018-10-12T02:20:25.577Z"
}
]
}
GET
RetrieveDispute
{{baseUrl}}/v2/disputes/:dispute_id
QUERY PARAMS
dispute_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/disputes/:dispute_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/disputes/:dispute_id")
require "http/client"
url = "{{baseUrl}}/v2/disputes/:dispute_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/disputes/:dispute_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/disputes/:dispute_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/disputes/:dispute_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/disputes/:dispute_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/disputes/:dispute_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/disputes/:dispute_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/disputes/:dispute_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/disputes/:dispute_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/disputes/:dispute_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/disputes/:dispute_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/disputes/:dispute_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/disputes/:dispute_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/disputes/:dispute_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/disputes/:dispute_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/disputes/:dispute_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/disputes/:dispute_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/disputes/:dispute_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/disputes/:dispute_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/disputes/:dispute_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/disputes/:dispute_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/disputes/:dispute_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/disputes/:dispute_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/disputes/:dispute_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/disputes/:dispute_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/disputes/:dispute_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/disputes/:dispute_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/disputes/:dispute_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/disputes/:dispute_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/disputes/:dispute_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/disputes/:dispute_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/disputes/:dispute_id
http GET {{baseUrl}}/v2/disputes/:dispute_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/disputes/:dispute_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/disputes/:dispute_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"dispute": {
"amount_money": {
"amount": 2000,
"currency": "USD"
},
"brand_dispute_id": "100000282394",
"card_brand": "VISA",
"created_at": "2018-10-18T15:59:13.613Z",
"disputed_payments": [
{
"payment_id": "6Ee10wvqhfipStz297mtUhBXvaB"
}
],
"due_at": "2018-11-01T00:00:00.000Z",
"id": "XDgyFu7yo1E2S5lQGGpYn",
"reason": "NO_KNOWLEDGE",
"state": "LOST",
"updated_at": "2018-10-18T15:59:13.613Z"
}
}
GET
RetrieveDisputeEvidence
{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id
QUERY PARAMS
dispute_id
evidence_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
require "http/client"
url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/disputes/:dispute_id/evidence/:evidence_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/disputes/:dispute_id/evidence/:evidence_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/disputes/:dispute_id/evidence/:evidence_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/disputes/:dispute_id/evidence/:evidence_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id
http GET {{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/disputes/:dispute_id/evidence/:evidence_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"evidence": {
"dispute_id": "bVTprrwk0gygTLZ96VX1oB",
"evidence_file": {
"filename": "evidence.tiff",
"filetype": "image/tiff"
},
"evidence_type": "GENERIC_EVIDENCE",
"id": "TOomLInj6iWmP3N8qfCXrB",
"uploaded_at": "2018-10-18T16:01:10.000Z"
}
}
POST
SubmitEvidence
{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence
QUERY PARAMS
dispute_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence")
require "http/client"
url = "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/disputes/:dispute_id/submit-evidence HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/disputes/:dispute_id/submit-evidence',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/disputes/:dispute_id/submit-evidence")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/disputes/:dispute_id/submit-evidence') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/disputes/:dispute_id/submit-evidence
http POST {{baseUrl}}/v2/disputes/:dispute_id/submit-evidence
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/disputes/:dispute_id/submit-evidence
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/disputes/:dispute_id/submit-evidence")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"dispute": {
"amount_money": {
"amount": 2000,
"currency": "USD"
},
"brand_dispute_id": "100000399240",
"card_brand": "VISA",
"created_at": "2018-10-18T16:02:15.313Z",
"disputed_payments": [
{
"payment_id": "2yeBUWJzllJTpmnSqtMRAL19taB"
}
],
"due_at": "2018-11-01T00:00:00.000Z",
"id": "EAZoK70gX3fyvibecLwIGB",
"reason": "NO_KNOWLEDGE",
"state": "PROCESSING",
"updated_at": "2018-10-18T16:02:15.313Z"
}
}
GET
ListEmployees (GET)
{{baseUrl}}/v2/employees
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/employees");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/employees")
require "http/client"
url = "{{baseUrl}}/v2/employees"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/employees"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/employees");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/employees"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/employees HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/employees")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/employees"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/employees")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/employees")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/employees');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/employees'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/employees';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/employees',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/employees")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/employees',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/employees'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/employees');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/employees'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/employees';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/employees"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/employees" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/employees",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/employees');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/employees');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/employees');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/employees' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/employees' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/employees")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/employees"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/employees"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/employees")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/employees') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/employees";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/employees
http GET {{baseUrl}}/v2/employees
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/employees
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/employees")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
RetrieveEmployee (GET)
{{baseUrl}}/v2/employees/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/employees/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/employees/:id")
require "http/client"
url = "{{baseUrl}}/v2/employees/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/employees/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/employees/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/employees/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/employees/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/employees/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/employees/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/employees/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/employees/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/employees/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/employees/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/employees/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/employees/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/employees/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/employees/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/employees/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/employees/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/employees/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/employees/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/employees/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/employees/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/employees/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/employees/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/employees/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/employees/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/employees/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/employees/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/employees/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/employees/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/employees/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/employees/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/employees/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/employees/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/employees/:id
http GET {{baseUrl}}/v2/employees/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/employees/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/employees/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
CreateGiftCardActivity
{{baseUrl}}/v2/gift-cards/activities
BODY json
{
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 0,
"currency": ""
},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"adjust_decrement_activity_details": {
"amount_money": {},
"reason": ""
},
"adjust_increment_activity_details": {
"amount_money": {},
"reason": ""
},
"block_activity_details": {
"reason": ""
},
"clear_balance_activity_details": {
"reason": ""
},
"created_at": "",
"deactivate_activity_details": {
"reason": ""
},
"gift_card_balance_money": {},
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": {
"amount_money": {}
},
"import_reversal_activity_details": {
"amount_money": {}
},
"load_activity_details": {
"amount_money": {},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"location_id": "",
"redeem_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
},
"refund_activity_details": {
"amount_money": {},
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
},
"type": "",
"unblock_activity_details": {
"reason": ""
},
"unlinked_activity_refund_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
}
},
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards/activities");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/gift-cards/activities" {:content-type :json
:form-params {:gift_card_activity {:activate_activity_details {:amount_money {:amount 0
:currency ""}
:buyer_payment_instrument_ids []
:line_item_uid ""
:order_id ""
:reference_id ""}
:adjust_decrement_activity_details {:amount_money {}
:reason ""}
:adjust_increment_activity_details {:amount_money {}
:reason ""}
:block_activity_details {:reason ""}
:clear_balance_activity_details {:reason ""}
:created_at ""
:deactivate_activity_details {:reason ""}
:gift_card_balance_money {}
:gift_card_gan ""
:gift_card_id ""
:id ""
:import_activity_details {:amount_money {}}
:import_reversal_activity_details {:amount_money {}}
:load_activity_details {:amount_money {}
:buyer_payment_instrument_ids []
:line_item_uid ""
:order_id ""
:reference_id ""}
:location_id ""
:redeem_activity_details {:amount_money {}
:payment_id ""
:reference_id ""}
:refund_activity_details {:amount_money {}
:payment_id ""
:redeem_activity_id ""
:reference_id ""}
:type ""
:unblock_activity_details {:reason ""}
:unlinked_activity_refund_activity_details {:amount_money {}
:payment_id ""
:reference_id ""}}
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/gift-cards/activities"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards/activities"),
Content = new StringContent("{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards/activities");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards/activities"
payload := strings.NewReader("{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/gift-cards/activities HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1602
{
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 0,
"currency": ""
},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"adjust_decrement_activity_details": {
"amount_money": {},
"reason": ""
},
"adjust_increment_activity_details": {
"amount_money": {},
"reason": ""
},
"block_activity_details": {
"reason": ""
},
"clear_balance_activity_details": {
"reason": ""
},
"created_at": "",
"deactivate_activity_details": {
"reason": ""
},
"gift_card_balance_money": {},
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": {
"amount_money": {}
},
"import_reversal_activity_details": {
"amount_money": {}
},
"load_activity_details": {
"amount_money": {},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"location_id": "",
"redeem_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
},
"refund_activity_details": {
"amount_money": {},
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
},
"type": "",
"unblock_activity_details": {
"reason": ""
},
"unlinked_activity_refund_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
}
},
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/gift-cards/activities")
.setHeader("content-type", "application/json")
.setBody("{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards/activities"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/activities")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/gift-cards/activities")
.header("content-type", "application/json")
.body("{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
gift_card_activity: {
activate_activity_details: {
amount_money: {
amount: 0,
currency: ''
},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
adjust_decrement_activity_details: {
amount_money: {},
reason: ''
},
adjust_increment_activity_details: {
amount_money: {},
reason: ''
},
block_activity_details: {
reason: ''
},
clear_balance_activity_details: {
reason: ''
},
created_at: '',
deactivate_activity_details: {
reason: ''
},
gift_card_balance_money: {},
gift_card_gan: '',
gift_card_id: '',
id: '',
import_activity_details: {
amount_money: {}
},
import_reversal_activity_details: {
amount_money: {}
},
load_activity_details: {
amount_money: {},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
location_id: '',
redeem_activity_details: {
amount_money: {},
payment_id: '',
reference_id: ''
},
refund_activity_details: {
amount_money: {},
payment_id: '',
redeem_activity_id: '',
reference_id: ''
},
type: '',
unblock_activity_details: {
reason: ''
},
unlinked_activity_refund_activity_details: {
amount_money: {},
payment_id: '',
reference_id: ''
}
},
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/gift-cards/activities');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/activities',
headers: {'content-type': 'application/json'},
data: {
gift_card_activity: {
activate_activity_details: {
amount_money: {amount: 0, currency: ''},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
adjust_decrement_activity_details: {amount_money: {}, reason: ''},
adjust_increment_activity_details: {amount_money: {}, reason: ''},
block_activity_details: {reason: ''},
clear_balance_activity_details: {reason: ''},
created_at: '',
deactivate_activity_details: {reason: ''},
gift_card_balance_money: {},
gift_card_gan: '',
gift_card_id: '',
id: '',
import_activity_details: {amount_money: {}},
import_reversal_activity_details: {amount_money: {}},
load_activity_details: {
amount_money: {},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
location_id: '',
redeem_activity_details: {amount_money: {}, payment_id: '', reference_id: ''},
refund_activity_details: {amount_money: {}, payment_id: '', redeem_activity_id: '', reference_id: ''},
type: '',
unblock_activity_details: {reason: ''},
unlinked_activity_refund_activity_details: {amount_money: {}, payment_id: '', reference_id: ''}
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards/activities';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"gift_card_activity":{"activate_activity_details":{"amount_money":{"amount":0,"currency":""},"buyer_payment_instrument_ids":[],"line_item_uid":"","order_id":"","reference_id":""},"adjust_decrement_activity_details":{"amount_money":{},"reason":""},"adjust_increment_activity_details":{"amount_money":{},"reason":""},"block_activity_details":{"reason":""},"clear_balance_activity_details":{"reason":""},"created_at":"","deactivate_activity_details":{"reason":""},"gift_card_balance_money":{},"gift_card_gan":"","gift_card_id":"","id":"","import_activity_details":{"amount_money":{}},"import_reversal_activity_details":{"amount_money":{}},"load_activity_details":{"amount_money":{},"buyer_payment_instrument_ids":[],"line_item_uid":"","order_id":"","reference_id":""},"location_id":"","redeem_activity_details":{"amount_money":{},"payment_id":"","reference_id":""},"refund_activity_details":{"amount_money":{},"payment_id":"","redeem_activity_id":"","reference_id":""},"type":"","unblock_activity_details":{"reason":""},"unlinked_activity_refund_activity_details":{"amount_money":{},"payment_id":"","reference_id":""}},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards/activities',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "gift_card_activity": {\n "activate_activity_details": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "buyer_payment_instrument_ids": [],\n "line_item_uid": "",\n "order_id": "",\n "reference_id": ""\n },\n "adjust_decrement_activity_details": {\n "amount_money": {},\n "reason": ""\n },\n "adjust_increment_activity_details": {\n "amount_money": {},\n "reason": ""\n },\n "block_activity_details": {\n "reason": ""\n },\n "clear_balance_activity_details": {\n "reason": ""\n },\n "created_at": "",\n "deactivate_activity_details": {\n "reason": ""\n },\n "gift_card_balance_money": {},\n "gift_card_gan": "",\n "gift_card_id": "",\n "id": "",\n "import_activity_details": {\n "amount_money": {}\n },\n "import_reversal_activity_details": {\n "amount_money": {}\n },\n "load_activity_details": {\n "amount_money": {},\n "buyer_payment_instrument_ids": [],\n "line_item_uid": "",\n "order_id": "",\n "reference_id": ""\n },\n "location_id": "",\n "redeem_activity_details": {\n "amount_money": {},\n "payment_id": "",\n "reference_id": ""\n },\n "refund_activity_details": {\n "amount_money": {},\n "payment_id": "",\n "redeem_activity_id": "",\n "reference_id": ""\n },\n "type": "",\n "unblock_activity_details": {\n "reason": ""\n },\n "unlinked_activity_refund_activity_details": {\n "amount_money": {},\n "payment_id": "",\n "reference_id": ""\n }\n },\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/activities")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards/activities',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
gift_card_activity: {
activate_activity_details: {
amount_money: {amount: 0, currency: ''},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
adjust_decrement_activity_details: {amount_money: {}, reason: ''},
adjust_increment_activity_details: {amount_money: {}, reason: ''},
block_activity_details: {reason: ''},
clear_balance_activity_details: {reason: ''},
created_at: '',
deactivate_activity_details: {reason: ''},
gift_card_balance_money: {},
gift_card_gan: '',
gift_card_id: '',
id: '',
import_activity_details: {amount_money: {}},
import_reversal_activity_details: {amount_money: {}},
load_activity_details: {
amount_money: {},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
location_id: '',
redeem_activity_details: {amount_money: {}, payment_id: '', reference_id: ''},
refund_activity_details: {amount_money: {}, payment_id: '', redeem_activity_id: '', reference_id: ''},
type: '',
unblock_activity_details: {reason: ''},
unlinked_activity_refund_activity_details: {amount_money: {}, payment_id: '', reference_id: ''}
},
idempotency_key: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/activities',
headers: {'content-type': 'application/json'},
body: {
gift_card_activity: {
activate_activity_details: {
amount_money: {amount: 0, currency: ''},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
adjust_decrement_activity_details: {amount_money: {}, reason: ''},
adjust_increment_activity_details: {amount_money: {}, reason: ''},
block_activity_details: {reason: ''},
clear_balance_activity_details: {reason: ''},
created_at: '',
deactivate_activity_details: {reason: ''},
gift_card_balance_money: {},
gift_card_gan: '',
gift_card_id: '',
id: '',
import_activity_details: {amount_money: {}},
import_reversal_activity_details: {amount_money: {}},
load_activity_details: {
amount_money: {},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
location_id: '',
redeem_activity_details: {amount_money: {}, payment_id: '', reference_id: ''},
refund_activity_details: {amount_money: {}, payment_id: '', redeem_activity_id: '', reference_id: ''},
type: '',
unblock_activity_details: {reason: ''},
unlinked_activity_refund_activity_details: {amount_money: {}, payment_id: '', reference_id: ''}
},
idempotency_key: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/gift-cards/activities');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
gift_card_activity: {
activate_activity_details: {
amount_money: {
amount: 0,
currency: ''
},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
adjust_decrement_activity_details: {
amount_money: {},
reason: ''
},
adjust_increment_activity_details: {
amount_money: {},
reason: ''
},
block_activity_details: {
reason: ''
},
clear_balance_activity_details: {
reason: ''
},
created_at: '',
deactivate_activity_details: {
reason: ''
},
gift_card_balance_money: {},
gift_card_gan: '',
gift_card_id: '',
id: '',
import_activity_details: {
amount_money: {}
},
import_reversal_activity_details: {
amount_money: {}
},
load_activity_details: {
amount_money: {},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
location_id: '',
redeem_activity_details: {
amount_money: {},
payment_id: '',
reference_id: ''
},
refund_activity_details: {
amount_money: {},
payment_id: '',
redeem_activity_id: '',
reference_id: ''
},
type: '',
unblock_activity_details: {
reason: ''
},
unlinked_activity_refund_activity_details: {
amount_money: {},
payment_id: '',
reference_id: ''
}
},
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/activities',
headers: {'content-type': 'application/json'},
data: {
gift_card_activity: {
activate_activity_details: {
amount_money: {amount: 0, currency: ''},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
adjust_decrement_activity_details: {amount_money: {}, reason: ''},
adjust_increment_activity_details: {amount_money: {}, reason: ''},
block_activity_details: {reason: ''},
clear_balance_activity_details: {reason: ''},
created_at: '',
deactivate_activity_details: {reason: ''},
gift_card_balance_money: {},
gift_card_gan: '',
gift_card_id: '',
id: '',
import_activity_details: {amount_money: {}},
import_reversal_activity_details: {amount_money: {}},
load_activity_details: {
amount_money: {},
buyer_payment_instrument_ids: [],
line_item_uid: '',
order_id: '',
reference_id: ''
},
location_id: '',
redeem_activity_details: {amount_money: {}, payment_id: '', reference_id: ''},
refund_activity_details: {amount_money: {}, payment_id: '', redeem_activity_id: '', reference_id: ''},
type: '',
unblock_activity_details: {reason: ''},
unlinked_activity_refund_activity_details: {amount_money: {}, payment_id: '', reference_id: ''}
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards/activities';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"gift_card_activity":{"activate_activity_details":{"amount_money":{"amount":0,"currency":""},"buyer_payment_instrument_ids":[],"line_item_uid":"","order_id":"","reference_id":""},"adjust_decrement_activity_details":{"amount_money":{},"reason":""},"adjust_increment_activity_details":{"amount_money":{},"reason":""},"block_activity_details":{"reason":""},"clear_balance_activity_details":{"reason":""},"created_at":"","deactivate_activity_details":{"reason":""},"gift_card_balance_money":{},"gift_card_gan":"","gift_card_id":"","id":"","import_activity_details":{"amount_money":{}},"import_reversal_activity_details":{"amount_money":{}},"load_activity_details":{"amount_money":{},"buyer_payment_instrument_ids":[],"line_item_uid":"","order_id":"","reference_id":""},"location_id":"","redeem_activity_details":{"amount_money":{},"payment_id":"","reference_id":""},"refund_activity_details":{"amount_money":{},"payment_id":"","redeem_activity_id":"","reference_id":""},"type":"","unblock_activity_details":{"reason":""},"unlinked_activity_refund_activity_details":{"amount_money":{},"payment_id":"","reference_id":""}},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"gift_card_activity": @{ @"activate_activity_details": @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"buyer_payment_instrument_ids": @[ ], @"line_item_uid": @"", @"order_id": @"", @"reference_id": @"" }, @"adjust_decrement_activity_details": @{ @"amount_money": @{ }, @"reason": @"" }, @"adjust_increment_activity_details": @{ @"amount_money": @{ }, @"reason": @"" }, @"block_activity_details": @{ @"reason": @"" }, @"clear_balance_activity_details": @{ @"reason": @"" }, @"created_at": @"", @"deactivate_activity_details": @{ @"reason": @"" }, @"gift_card_balance_money": @{ }, @"gift_card_gan": @"", @"gift_card_id": @"", @"id": @"", @"import_activity_details": @{ @"amount_money": @{ } }, @"import_reversal_activity_details": @{ @"amount_money": @{ } }, @"load_activity_details": @{ @"amount_money": @{ }, @"buyer_payment_instrument_ids": @[ ], @"line_item_uid": @"", @"order_id": @"", @"reference_id": @"" }, @"location_id": @"", @"redeem_activity_details": @{ @"amount_money": @{ }, @"payment_id": @"", @"reference_id": @"" }, @"refund_activity_details": @{ @"amount_money": @{ }, @"payment_id": @"", @"redeem_activity_id": @"", @"reference_id": @"" }, @"type": @"", @"unblock_activity_details": @{ @"reason": @"" }, @"unlinked_activity_refund_activity_details": @{ @"amount_money": @{ }, @"payment_id": @"", @"reference_id": @"" } },
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards/activities"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards/activities" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards/activities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'gift_card_activity' => [
'activate_activity_details' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'buyer_payment_instrument_ids' => [
],
'line_item_uid' => '',
'order_id' => '',
'reference_id' => ''
],
'adjust_decrement_activity_details' => [
'amount_money' => [
],
'reason' => ''
],
'adjust_increment_activity_details' => [
'amount_money' => [
],
'reason' => ''
],
'block_activity_details' => [
'reason' => ''
],
'clear_balance_activity_details' => [
'reason' => ''
],
'created_at' => '',
'deactivate_activity_details' => [
'reason' => ''
],
'gift_card_balance_money' => [
],
'gift_card_gan' => '',
'gift_card_id' => '',
'id' => '',
'import_activity_details' => [
'amount_money' => [
]
],
'import_reversal_activity_details' => [
'amount_money' => [
]
],
'load_activity_details' => [
'amount_money' => [
],
'buyer_payment_instrument_ids' => [
],
'line_item_uid' => '',
'order_id' => '',
'reference_id' => ''
],
'location_id' => '',
'redeem_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'reference_id' => ''
],
'refund_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'redeem_activity_id' => '',
'reference_id' => ''
],
'type' => '',
'unblock_activity_details' => [
'reason' => ''
],
'unlinked_activity_refund_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'reference_id' => ''
]
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/gift-cards/activities', [
'body' => '{
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 0,
"currency": ""
},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"adjust_decrement_activity_details": {
"amount_money": {},
"reason": ""
},
"adjust_increment_activity_details": {
"amount_money": {},
"reason": ""
},
"block_activity_details": {
"reason": ""
},
"clear_balance_activity_details": {
"reason": ""
},
"created_at": "",
"deactivate_activity_details": {
"reason": ""
},
"gift_card_balance_money": {},
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": {
"amount_money": {}
},
"import_reversal_activity_details": {
"amount_money": {}
},
"load_activity_details": {
"amount_money": {},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"location_id": "",
"redeem_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
},
"refund_activity_details": {
"amount_money": {},
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
},
"type": "",
"unblock_activity_details": {
"reason": ""
},
"unlinked_activity_refund_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
}
},
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards/activities');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'gift_card_activity' => [
'activate_activity_details' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'buyer_payment_instrument_ids' => [
],
'line_item_uid' => '',
'order_id' => '',
'reference_id' => ''
],
'adjust_decrement_activity_details' => [
'amount_money' => [
],
'reason' => ''
],
'adjust_increment_activity_details' => [
'amount_money' => [
],
'reason' => ''
],
'block_activity_details' => [
'reason' => ''
],
'clear_balance_activity_details' => [
'reason' => ''
],
'created_at' => '',
'deactivate_activity_details' => [
'reason' => ''
],
'gift_card_balance_money' => [
],
'gift_card_gan' => '',
'gift_card_id' => '',
'id' => '',
'import_activity_details' => [
'amount_money' => [
]
],
'import_reversal_activity_details' => [
'amount_money' => [
]
],
'load_activity_details' => [
'amount_money' => [
],
'buyer_payment_instrument_ids' => [
],
'line_item_uid' => '',
'order_id' => '',
'reference_id' => ''
],
'location_id' => '',
'redeem_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'reference_id' => ''
],
'refund_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'redeem_activity_id' => '',
'reference_id' => ''
],
'type' => '',
'unblock_activity_details' => [
'reason' => ''
],
'unlinked_activity_refund_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'reference_id' => ''
]
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'gift_card_activity' => [
'activate_activity_details' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'buyer_payment_instrument_ids' => [
],
'line_item_uid' => '',
'order_id' => '',
'reference_id' => ''
],
'adjust_decrement_activity_details' => [
'amount_money' => [
],
'reason' => ''
],
'adjust_increment_activity_details' => [
'amount_money' => [
],
'reason' => ''
],
'block_activity_details' => [
'reason' => ''
],
'clear_balance_activity_details' => [
'reason' => ''
],
'created_at' => '',
'deactivate_activity_details' => [
'reason' => ''
],
'gift_card_balance_money' => [
],
'gift_card_gan' => '',
'gift_card_id' => '',
'id' => '',
'import_activity_details' => [
'amount_money' => [
]
],
'import_reversal_activity_details' => [
'amount_money' => [
]
],
'load_activity_details' => [
'amount_money' => [
],
'buyer_payment_instrument_ids' => [
],
'line_item_uid' => '',
'order_id' => '',
'reference_id' => ''
],
'location_id' => '',
'redeem_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'reference_id' => ''
],
'refund_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'redeem_activity_id' => '',
'reference_id' => ''
],
'type' => '',
'unblock_activity_details' => [
'reason' => ''
],
'unlinked_activity_refund_activity_details' => [
'amount_money' => [
],
'payment_id' => '',
'reference_id' => ''
]
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/gift-cards/activities');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards/activities' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 0,
"currency": ""
},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"adjust_decrement_activity_details": {
"amount_money": {},
"reason": ""
},
"adjust_increment_activity_details": {
"amount_money": {},
"reason": ""
},
"block_activity_details": {
"reason": ""
},
"clear_balance_activity_details": {
"reason": ""
},
"created_at": "",
"deactivate_activity_details": {
"reason": ""
},
"gift_card_balance_money": {},
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": {
"amount_money": {}
},
"import_reversal_activity_details": {
"amount_money": {}
},
"load_activity_details": {
"amount_money": {},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"location_id": "",
"redeem_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
},
"refund_activity_details": {
"amount_money": {},
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
},
"type": "",
"unblock_activity_details": {
"reason": ""
},
"unlinked_activity_refund_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
}
},
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards/activities' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 0,
"currency": ""
},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"adjust_decrement_activity_details": {
"amount_money": {},
"reason": ""
},
"adjust_increment_activity_details": {
"amount_money": {},
"reason": ""
},
"block_activity_details": {
"reason": ""
},
"clear_balance_activity_details": {
"reason": ""
},
"created_at": "",
"deactivate_activity_details": {
"reason": ""
},
"gift_card_balance_money": {},
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": {
"amount_money": {}
},
"import_reversal_activity_details": {
"amount_money": {}
},
"load_activity_details": {
"amount_money": {},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"location_id": "",
"redeem_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
},
"refund_activity_details": {
"amount_money": {},
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
},
"type": "",
"unblock_activity_details": {
"reason": ""
},
"unlinked_activity_refund_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
}
},
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/gift-cards/activities", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards/activities"
payload = {
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 0,
"currency": ""
},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"adjust_decrement_activity_details": {
"amount_money": {},
"reason": ""
},
"adjust_increment_activity_details": {
"amount_money": {},
"reason": ""
},
"block_activity_details": { "reason": "" },
"clear_balance_activity_details": { "reason": "" },
"created_at": "",
"deactivate_activity_details": { "reason": "" },
"gift_card_balance_money": {},
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": { "amount_money": {} },
"import_reversal_activity_details": { "amount_money": {} },
"load_activity_details": {
"amount_money": {},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"location_id": "",
"redeem_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
},
"refund_activity_details": {
"amount_money": {},
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
},
"type": "",
"unblock_activity_details": { "reason": "" },
"unlinked_activity_refund_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
}
},
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards/activities"
payload <- "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards/activities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/gift-cards/activities') do |req|
req.body = "{\n \"gift_card_activity\": {\n \"activate_activity_details\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"adjust_decrement_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"adjust_increment_activity_details\": {\n \"amount_money\": {},\n \"reason\": \"\"\n },\n \"block_activity_details\": {\n \"reason\": \"\"\n },\n \"clear_balance_activity_details\": {\n \"reason\": \"\"\n },\n \"created_at\": \"\",\n \"deactivate_activity_details\": {\n \"reason\": \"\"\n },\n \"gift_card_balance_money\": {},\n \"gift_card_gan\": \"\",\n \"gift_card_id\": \"\",\n \"id\": \"\",\n \"import_activity_details\": {\n \"amount_money\": {}\n },\n \"import_reversal_activity_details\": {\n \"amount_money\": {}\n },\n \"load_activity_details\": {\n \"amount_money\": {},\n \"buyer_payment_instrument_ids\": [],\n \"line_item_uid\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\"\n },\n \"location_id\": \"\",\n \"redeem_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n },\n \"refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"redeem_activity_id\": \"\",\n \"reference_id\": \"\"\n },\n \"type\": \"\",\n \"unblock_activity_details\": {\n \"reason\": \"\"\n },\n \"unlinked_activity_refund_activity_details\": {\n \"amount_money\": {},\n \"payment_id\": \"\",\n \"reference_id\": \"\"\n }\n },\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards/activities";
let payload = json!({
"gift_card_activity": json!({
"activate_activity_details": json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"buyer_payment_instrument_ids": (),
"line_item_uid": "",
"order_id": "",
"reference_id": ""
}),
"adjust_decrement_activity_details": json!({
"amount_money": json!({}),
"reason": ""
}),
"adjust_increment_activity_details": json!({
"amount_money": json!({}),
"reason": ""
}),
"block_activity_details": json!({"reason": ""}),
"clear_balance_activity_details": json!({"reason": ""}),
"created_at": "",
"deactivate_activity_details": json!({"reason": ""}),
"gift_card_balance_money": json!({}),
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": json!({"amount_money": json!({})}),
"import_reversal_activity_details": json!({"amount_money": json!({})}),
"load_activity_details": json!({
"amount_money": json!({}),
"buyer_payment_instrument_ids": (),
"line_item_uid": "",
"order_id": "",
"reference_id": ""
}),
"location_id": "",
"redeem_activity_details": json!({
"amount_money": json!({}),
"payment_id": "",
"reference_id": ""
}),
"refund_activity_details": json!({
"amount_money": json!({}),
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
}),
"type": "",
"unblock_activity_details": json!({"reason": ""}),
"unlinked_activity_refund_activity_details": json!({
"amount_money": json!({}),
"payment_id": "",
"reference_id": ""
})
}),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/gift-cards/activities \
--header 'content-type: application/json' \
--data '{
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 0,
"currency": ""
},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"adjust_decrement_activity_details": {
"amount_money": {},
"reason": ""
},
"adjust_increment_activity_details": {
"amount_money": {},
"reason": ""
},
"block_activity_details": {
"reason": ""
},
"clear_balance_activity_details": {
"reason": ""
},
"created_at": "",
"deactivate_activity_details": {
"reason": ""
},
"gift_card_balance_money": {},
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": {
"amount_money": {}
},
"import_reversal_activity_details": {
"amount_money": {}
},
"load_activity_details": {
"amount_money": {},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"location_id": "",
"redeem_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
},
"refund_activity_details": {
"amount_money": {},
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
},
"type": "",
"unblock_activity_details": {
"reason": ""
},
"unlinked_activity_refund_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
}
},
"idempotency_key": ""
}'
echo '{
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 0,
"currency": ""
},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"adjust_decrement_activity_details": {
"amount_money": {},
"reason": ""
},
"adjust_increment_activity_details": {
"amount_money": {},
"reason": ""
},
"block_activity_details": {
"reason": ""
},
"clear_balance_activity_details": {
"reason": ""
},
"created_at": "",
"deactivate_activity_details": {
"reason": ""
},
"gift_card_balance_money": {},
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": {
"amount_money": {}
},
"import_reversal_activity_details": {
"amount_money": {}
},
"load_activity_details": {
"amount_money": {},
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
},
"location_id": "",
"redeem_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
},
"refund_activity_details": {
"amount_money": {},
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
},
"type": "",
"unblock_activity_details": {
"reason": ""
},
"unlinked_activity_refund_activity_details": {
"amount_money": {},
"payment_id": "",
"reference_id": ""
}
},
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/gift-cards/activities \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "gift_card_activity": {\n "activate_activity_details": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "buyer_payment_instrument_ids": [],\n "line_item_uid": "",\n "order_id": "",\n "reference_id": ""\n },\n "adjust_decrement_activity_details": {\n "amount_money": {},\n "reason": ""\n },\n "adjust_increment_activity_details": {\n "amount_money": {},\n "reason": ""\n },\n "block_activity_details": {\n "reason": ""\n },\n "clear_balance_activity_details": {\n "reason": ""\n },\n "created_at": "",\n "deactivate_activity_details": {\n "reason": ""\n },\n "gift_card_balance_money": {},\n "gift_card_gan": "",\n "gift_card_id": "",\n "id": "",\n "import_activity_details": {\n "amount_money": {}\n },\n "import_reversal_activity_details": {\n "amount_money": {}\n },\n "load_activity_details": {\n "amount_money": {},\n "buyer_payment_instrument_ids": [],\n "line_item_uid": "",\n "order_id": "",\n "reference_id": ""\n },\n "location_id": "",\n "redeem_activity_details": {\n "amount_money": {},\n "payment_id": "",\n "reference_id": ""\n },\n "refund_activity_details": {\n "amount_money": {},\n "payment_id": "",\n "redeem_activity_id": "",\n "reference_id": ""\n },\n "type": "",\n "unblock_activity_details": {\n "reason": ""\n },\n "unlinked_activity_refund_activity_details": {\n "amount_money": {},\n "payment_id": "",\n "reference_id": ""\n }\n },\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/gift-cards/activities
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"gift_card_activity": [
"activate_activity_details": [
"amount_money": [
"amount": 0,
"currency": ""
],
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
],
"adjust_decrement_activity_details": [
"amount_money": [],
"reason": ""
],
"adjust_increment_activity_details": [
"amount_money": [],
"reason": ""
],
"block_activity_details": ["reason": ""],
"clear_balance_activity_details": ["reason": ""],
"created_at": "",
"deactivate_activity_details": ["reason": ""],
"gift_card_balance_money": [],
"gift_card_gan": "",
"gift_card_id": "",
"id": "",
"import_activity_details": ["amount_money": []],
"import_reversal_activity_details": ["amount_money": []],
"load_activity_details": [
"amount_money": [],
"buyer_payment_instrument_ids": [],
"line_item_uid": "",
"order_id": "",
"reference_id": ""
],
"location_id": "",
"redeem_activity_details": [
"amount_money": [],
"payment_id": "",
"reference_id": ""
],
"refund_activity_details": [
"amount_money": [],
"payment_id": "",
"redeem_activity_id": "",
"reference_id": ""
],
"type": "",
"unblock_activity_details": ["reason": ""],
"unlinked_activity_refund_activity_details": [
"amount_money": [],
"payment_id": "",
"reference_id": ""
]
],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards/activities")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"gift_card_activity": {
"activate_activity_details": {
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"line_item_uid": "eIWl7X0nMuO9Ewbh0ChIx",
"order_id": "jJNGHm4gLI6XkFbwtiSLqK72KkAZY"
},
"created_at": "2021-05-20T22:26:54.000Z",
"gift_card_balance_money": {
"amount": 1000,
"currency": "USD"
},
"gift_card_gan": "7783320002929081",
"gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20",
"id": "gcact_c8f8cbf1f24b448d8ecf39ed03f97864",
"location_id": "81FN9BNFZTKS4",
"type": "ACTIVATE"
}
}
GET
ListGiftCardActivities
{{baseUrl}}/v2/gift-cards/activities
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards/activities");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/gift-cards/activities")
require "http/client"
url = "{{baseUrl}}/v2/gift-cards/activities"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards/activities"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards/activities");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards/activities"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/gift-cards/activities HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/gift-cards/activities")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards/activities"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/activities")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/gift-cards/activities")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/gift-cards/activities');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards/activities'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards/activities';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards/activities',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/activities")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards/activities',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards/activities'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/gift-cards/activities');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards/activities'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards/activities';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards/activities"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards/activities" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards/activities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/gift-cards/activities');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards/activities');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/gift-cards/activities');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards/activities' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards/activities' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/gift-cards/activities")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards/activities"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards/activities"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards/activities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/gift-cards/activities') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards/activities";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/gift-cards/activities
http GET {{baseUrl}}/v2/gift-cards/activities
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/gift-cards/activities
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards/activities")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"gift_card_activities": [
{
"created_at": "2021-06-02T22:26:38.000Z",
"gift_card_balance_money": {
"amount": 700,
"currency": "USD"
},
"gift_card_gan": "7783320002929081",
"gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20",
"id": "gcact_897698f894b44b3db46c6147e26a0e19",
"location_id": "81FN9BNFZTKS4",
"redeem_activity_details": {
"amount_money": {
"amount": 300,
"currency": "USD"
}
},
"type": "REDEEM"
},
{
"activate_activity_details": {
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"line_item_uid": "eIWl7X0nMuO9Ewbh0ChIx",
"order_id": "jJNGHm4gLI6XkFbwtiSLqK72KkAZY"
},
"created_at": "2021-05-20T22:26:54.000Z",
"gift_card_balance_money": {
"amount": 1000,
"currency": "USD"
},
"gift_card_gan": "7783320002929081",
"gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20",
"id": "gcact_b968ebfc7d46437b945be7b9e09123b4",
"location_id": "81FN9BNFZTKS4",
"type": "ACTIVATE"
}
]
}
POST
CreateGiftCard
{{baseUrl}}/v2/gift-cards
BODY json
{
"gift_card": {
"balance_money": {
"amount": 0,
"currency": ""
},
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
},
"idempotency_key": "",
"location_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/gift-cards" {:content-type :json
:form-params {:gift_card {:balance_money {:amount 0
:currency ""}
:created_at ""
:customer_ids []
:gan ""
:gan_source ""
:id ""
:state ""
:type ""}
:idempotency_key ""
:location_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/gift-cards"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards"),
Content = new StringContent("{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards"
payload := strings.NewReader("{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/gift-cards HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 269
{
"gift_card": {
"balance_money": {
"amount": 0,
"currency": ""
},
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
},
"idempotency_key": "",
"location_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/gift-cards")
.setHeader("content-type", "application/json")
.setBody("{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/gift-cards")
.header("content-type", "application/json")
.body("{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
gift_card: {
balance_money: {
amount: 0,
currency: ''
},
created_at: '',
customer_ids: [],
gan: '',
gan_source: '',
id: '',
state: '',
type: ''
},
idempotency_key: '',
location_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/gift-cards');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards',
headers: {'content-type': 'application/json'},
data: {
gift_card: {
balance_money: {amount: 0, currency: ''},
created_at: '',
customer_ids: [],
gan: '',
gan_source: '',
id: '',
state: '',
type: ''
},
idempotency_key: '',
location_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"gift_card":{"balance_money":{"amount":0,"currency":""},"created_at":"","customer_ids":[],"gan":"","gan_source":"","id":"","state":"","type":""},"idempotency_key":"","location_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "gift_card": {\n "balance_money": {\n "amount": 0,\n "currency": ""\n },\n "created_at": "",\n "customer_ids": [],\n "gan": "",\n "gan_source": "",\n "id": "",\n "state": "",\n "type": ""\n },\n "idempotency_key": "",\n "location_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
gift_card: {
balance_money: {amount: 0, currency: ''},
created_at: '',
customer_ids: [],
gan: '',
gan_source: '',
id: '',
state: '',
type: ''
},
idempotency_key: '',
location_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards',
headers: {'content-type': 'application/json'},
body: {
gift_card: {
balance_money: {amount: 0, currency: ''},
created_at: '',
customer_ids: [],
gan: '',
gan_source: '',
id: '',
state: '',
type: ''
},
idempotency_key: '',
location_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/gift-cards');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
gift_card: {
balance_money: {
amount: 0,
currency: ''
},
created_at: '',
customer_ids: [],
gan: '',
gan_source: '',
id: '',
state: '',
type: ''
},
idempotency_key: '',
location_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards',
headers: {'content-type': 'application/json'},
data: {
gift_card: {
balance_money: {amount: 0, currency: ''},
created_at: '',
customer_ids: [],
gan: '',
gan_source: '',
id: '',
state: '',
type: ''
},
idempotency_key: '',
location_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"gift_card":{"balance_money":{"amount":0,"currency":""},"created_at":"","customer_ids":[],"gan":"","gan_source":"","id":"","state":"","type":""},"idempotency_key":"","location_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"gift_card": @{ @"balance_money": @{ @"amount": @0, @"currency": @"" }, @"created_at": @"", @"customer_ids": @[ ], @"gan": @"", @"gan_source": @"", @"id": @"", @"state": @"", @"type": @"" },
@"idempotency_key": @"",
@"location_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'gift_card' => [
'balance_money' => [
'amount' => 0,
'currency' => ''
],
'created_at' => '',
'customer_ids' => [
],
'gan' => '',
'gan_source' => '',
'id' => '',
'state' => '',
'type' => ''
],
'idempotency_key' => '',
'location_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/gift-cards', [
'body' => '{
"gift_card": {
"balance_money": {
"amount": 0,
"currency": ""
},
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
},
"idempotency_key": "",
"location_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'gift_card' => [
'balance_money' => [
'amount' => 0,
'currency' => ''
],
'created_at' => '',
'customer_ids' => [
],
'gan' => '',
'gan_source' => '',
'id' => '',
'state' => '',
'type' => ''
],
'idempotency_key' => '',
'location_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'gift_card' => [
'balance_money' => [
'amount' => 0,
'currency' => ''
],
'created_at' => '',
'customer_ids' => [
],
'gan' => '',
'gan_source' => '',
'id' => '',
'state' => '',
'type' => ''
],
'idempotency_key' => '',
'location_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/gift-cards');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"gift_card": {
"balance_money": {
"amount": 0,
"currency": ""
},
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
},
"idempotency_key": "",
"location_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"gift_card": {
"balance_money": {
"amount": 0,
"currency": ""
},
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
},
"idempotency_key": "",
"location_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/gift-cards", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards"
payload = {
"gift_card": {
"balance_money": {
"amount": 0,
"currency": ""
},
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
},
"idempotency_key": "",
"location_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards"
payload <- "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/gift-cards') do |req|
req.body = "{\n \"gift_card\": {\n \"balance_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"created_at\": \"\",\n \"customer_ids\": [],\n \"gan\": \"\",\n \"gan_source\": \"\",\n \"id\": \"\",\n \"state\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards";
let payload = json!({
"gift_card": json!({
"balance_money": json!({
"amount": 0,
"currency": ""
}),
"created_at": "",
"customer_ids": (),
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
}),
"idempotency_key": "",
"location_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/gift-cards \
--header 'content-type: application/json' \
--data '{
"gift_card": {
"balance_money": {
"amount": 0,
"currency": ""
},
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
},
"idempotency_key": "",
"location_id": ""
}'
echo '{
"gift_card": {
"balance_money": {
"amount": 0,
"currency": ""
},
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
},
"idempotency_key": "",
"location_id": ""
}' | \
http POST {{baseUrl}}/v2/gift-cards \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "gift_card": {\n "balance_money": {\n "amount": 0,\n "currency": ""\n },\n "created_at": "",\n "customer_ids": [],\n "gan": "",\n "gan_source": "",\n "id": "",\n "state": "",\n "type": ""\n },\n "idempotency_key": "",\n "location_id": ""\n}' \
--output-document \
- {{baseUrl}}/v2/gift-cards
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"gift_card": [
"balance_money": [
"amount": 0,
"currency": ""
],
"created_at": "",
"customer_ids": [],
"gan": "",
"gan_source": "",
"id": "",
"state": "",
"type": ""
],
"idempotency_key": "",
"location_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"gift_card": {
"balance_money": {
"amount": 0,
"currency": "USD"
},
"created_at": "2021-05-20T22:26:54.000Z",
"gan": "7783320006753271",
"gan_source": "SQUARE",
"id": "gftc:6cbacbb64cf54e2ca9f573d619038059",
"state": "PENDING",
"type": "DIGITAL"
}
}
POST
LinkCustomerToGiftCard
{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer
QUERY PARAMS
gift_card_id
BODY json
{
"customer_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"customer_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer" {:content-type :json
:form-params {:customer_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"customer_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer"),
Content = new StringContent("{\n \"customer_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"customer_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer"
payload := strings.NewReader("{\n \"customer_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/gift-cards/:gift_card_id/link-customer HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 23
{
"customer_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer")
.setHeader("content-type", "application/json")
.setBody("{\n \"customer_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"customer_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"customer_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer")
.header("content-type", "application/json")
.body("{\n \"customer_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
customer_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer',
headers: {'content-type': 'application/json'},
data: {customer_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customer_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "customer_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"customer_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards/:gift_card_id/link-customer',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({customer_id: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer',
headers: {'content-type': 'application/json'},
body: {customer_id: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
customer_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer',
headers: {'content-type': 'application/json'},
data: {customer_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customer_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"customer_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"customer_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer', [
'body' => '{
"customer_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'customer_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'customer_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customer_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customer_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"customer_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/gift-cards/:gift_card_id/link-customer", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer"
payload = { "customer_id": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer"
payload <- "{\n \"customer_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"customer_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/gift-cards/:gift_card_id/link-customer') do |req|
req.body = "{\n \"customer_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer";
let payload = json!({"customer_id": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer \
--header 'content-type: application/json' \
--data '{
"customer_id": ""
}'
echo '{
"customer_id": ""
}' | \
http POST {{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "customer_id": ""\n}' \
--output-document \
- {{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["customer_id": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards/:gift_card_id/link-customer")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"gift_card": {
"balance_money": {
"amount": 2500,
"currency": "USD"
},
"created_at": "2021-03-25T05:13:01Z",
"customer_ids": [
"GKY0FZ3V717AH8Q2D821PNT2ZW"
],
"gan": "7783320005440920",
"gan_source": "SQUARE",
"id": "gftc:71ea002277a34f8a945e284b04822edb",
"state": "ACTIVE",
"type": "DIGITAL"
}
}
GET
ListGiftCards
{{baseUrl}}/v2/gift-cards
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/gift-cards")
require "http/client"
url = "{{baseUrl}}/v2/gift-cards"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/gift-cards HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/gift-cards")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/gift-cards")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/gift-cards');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/gift-cards');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/gift-cards');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/gift-cards');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/gift-cards")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/gift-cards') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/gift-cards
http GET {{baseUrl}}/v2/gift-cards
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/gift-cards
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "JbFmyvUpaNKsfC1hoLSA4WlqkgkZXTWeKuStajR5BkP7OE0ETAbeWSi6U6u7sH",
"gift_cards": [
{
"balance_money": {
"amount": 3900,
"currency": "USD"
},
"created_at": "2021-06-09T22:26:54.000Z",
"gan": "7783320008524605",
"gan_source": "SQUARE",
"id": "gftc:00113070ba5745f0b2377c1b9570cb03",
"state": "ACTIVE",
"type": "DIGITAL"
},
{
"balance_money": {
"amount": 2000,
"currency": "USD"
},
"created_at": "2021-05-20T22:26:54.000Z",
"gan": "7783320002692465",
"gan_source": "SQUARE",
"id": "gftc:00128a12725b41e58e0de1d20497a9dd",
"state": "ACTIVE",
"type": "DIGITAL"
}
]
}
GET
RetrieveGiftCard
{{baseUrl}}/v2/gift-cards/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/gift-cards/:id")
require "http/client"
url = "{{baseUrl}}/v2/gift-cards/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/gift-cards/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/gift-cards/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/gift-cards/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/gift-cards/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/gift-cards/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/gift-cards/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/gift-cards/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/gift-cards/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/gift-cards/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/gift-cards/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/gift-cards/:id
http GET {{baseUrl}}/v2/gift-cards/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/gift-cards/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"gift_card": {
"balance_money": {
"amount": 1000,
"currency": "USD"
},
"created_at": "2021-05-20T22:26:54.000Z",
"gan": "7783320001001635",
"gan_source": "SQUARE",
"id": "gftc:00113070ba5745f0b2377c1b9570cb03",
"state": "ACTIVE",
"type": "DIGITAL"
}
}
POST
RetrieveGiftCardFromGAN
{{baseUrl}}/v2/gift-cards/from-gan
BODY json
{
"gan": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards/from-gan");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"gan\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/gift-cards/from-gan" {:content-type :json
:form-params {:gan ""}})
require "http/client"
url = "{{baseUrl}}/v2/gift-cards/from-gan"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"gan\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards/from-gan"),
Content = new StringContent("{\n \"gan\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards/from-gan");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"gan\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards/from-gan"
payload := strings.NewReader("{\n \"gan\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/gift-cards/from-gan HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 15
{
"gan": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/gift-cards/from-gan")
.setHeader("content-type", "application/json")
.setBody("{\n \"gan\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards/from-gan"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"gan\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"gan\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/from-gan")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/gift-cards/from-gan")
.header("content-type", "application/json")
.body("{\n \"gan\": \"\"\n}")
.asString();
const data = JSON.stringify({
gan: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/gift-cards/from-gan');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/from-gan',
headers: {'content-type': 'application/json'},
data: {gan: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards/from-gan';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"gan":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards/from-gan',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "gan": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"gan\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/from-gan")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards/from-gan',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({gan: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/from-gan',
headers: {'content-type': 'application/json'},
body: {gan: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/gift-cards/from-gan');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
gan: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/from-gan',
headers: {'content-type': 'application/json'},
data: {gan: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards/from-gan';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"gan":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"gan": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards/from-gan"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards/from-gan" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"gan\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards/from-gan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'gan' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/gift-cards/from-gan', [
'body' => '{
"gan": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards/from-gan');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'gan' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'gan' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/gift-cards/from-gan');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards/from-gan' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"gan": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards/from-gan' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"gan": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"gan\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/gift-cards/from-gan", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards/from-gan"
payload = { "gan": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards/from-gan"
payload <- "{\n \"gan\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards/from-gan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"gan\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/gift-cards/from-gan') do |req|
req.body = "{\n \"gan\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards/from-gan";
let payload = json!({"gan": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/gift-cards/from-gan \
--header 'content-type: application/json' \
--data '{
"gan": ""
}'
echo '{
"gan": ""
}' | \
http POST {{baseUrl}}/v2/gift-cards/from-gan \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "gan": ""\n}' \
--output-document \
- {{baseUrl}}/v2/gift-cards/from-gan
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["gan": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards/from-gan")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"gift_card": {
"balance_money": {
"amount": 5000,
"currency": "USD"
},
"created_at": "2021-05-20T22:26:54.000Z",
"gan": "7783320001001635",
"gan_source": "SQUARE",
"id": "gftc:6944163553804e439d89adb47caf806a",
"state": "ACTIVE",
"type": "DIGITAL"
}
}
POST
RetrieveGiftCardFromNonce
{{baseUrl}}/v2/gift-cards/from-nonce
BODY json
{
"nonce": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards/from-nonce");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"nonce\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/gift-cards/from-nonce" {:content-type :json
:form-params {:nonce ""}})
require "http/client"
url = "{{baseUrl}}/v2/gift-cards/from-nonce"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"nonce\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards/from-nonce"),
Content = new StringContent("{\n \"nonce\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards/from-nonce");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"nonce\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards/from-nonce"
payload := strings.NewReader("{\n \"nonce\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/gift-cards/from-nonce HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"nonce": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/gift-cards/from-nonce")
.setHeader("content-type", "application/json")
.setBody("{\n \"nonce\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards/from-nonce"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"nonce\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nonce\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/from-nonce")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/gift-cards/from-nonce")
.header("content-type", "application/json")
.body("{\n \"nonce\": \"\"\n}")
.asString();
const data = JSON.stringify({
nonce: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/gift-cards/from-nonce');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/from-nonce',
headers: {'content-type': 'application/json'},
data: {nonce: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards/from-nonce';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"nonce":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards/from-nonce',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "nonce": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"nonce\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/from-nonce")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards/from-nonce',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({nonce: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/from-nonce',
headers: {'content-type': 'application/json'},
body: {nonce: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/gift-cards/from-nonce');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
nonce: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/from-nonce',
headers: {'content-type': 'application/json'},
data: {nonce: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards/from-nonce';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"nonce":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"nonce": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards/from-nonce"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards/from-nonce" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"nonce\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards/from-nonce",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'nonce' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/gift-cards/from-nonce', [
'body' => '{
"nonce": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards/from-nonce');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'nonce' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'nonce' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/gift-cards/from-nonce');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards/from-nonce' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"nonce": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards/from-nonce' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"nonce": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"nonce\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/gift-cards/from-nonce", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards/from-nonce"
payload = { "nonce": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards/from-nonce"
payload <- "{\n \"nonce\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards/from-nonce")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"nonce\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/gift-cards/from-nonce') do |req|
req.body = "{\n \"nonce\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards/from-nonce";
let payload = json!({"nonce": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/gift-cards/from-nonce \
--header 'content-type: application/json' \
--data '{
"nonce": ""
}'
echo '{
"nonce": ""
}' | \
http POST {{baseUrl}}/v2/gift-cards/from-nonce \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "nonce": ""\n}' \
--output-document \
- {{baseUrl}}/v2/gift-cards/from-nonce
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["nonce": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards/from-nonce")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"gift_card": {
"balance_money": {
"amount": 5000,
"currency": "USD"
},
"created_at": "2021-05-20T22:26:54.000Z",
"gan": "7783320001001635",
"gan_source": "SQUARE",
"id": "gftc:6944163553804e439d89adb47caf806a",
"state": "ACTIVE",
"type": "DIGITAL"
}
}
POST
UnlinkCustomerFromGiftCard
{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer
QUERY PARAMS
gift_card_id
BODY json
{
"customer_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"customer_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer" {:content-type :json
:form-params {:customer_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"customer_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer"),
Content = new StringContent("{\n \"customer_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"customer_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer"
payload := strings.NewReader("{\n \"customer_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/gift-cards/:gift_card_id/unlink-customer HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 23
{
"customer_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer")
.setHeader("content-type", "application/json")
.setBody("{\n \"customer_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"customer_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"customer_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer")
.header("content-type", "application/json")
.body("{\n \"customer_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
customer_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer',
headers: {'content-type': 'application/json'},
data: {customer_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customer_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "customer_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"customer_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/gift-cards/:gift_card_id/unlink-customer',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({customer_id: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer',
headers: {'content-type': 'application/json'},
body: {customer_id: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
customer_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer',
headers: {'content-type': 'application/json'},
data: {customer_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customer_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"customer_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"customer_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer', [
'body' => '{
"customer_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'customer_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'customer_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customer_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customer_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"customer_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/gift-cards/:gift_card_id/unlink-customer", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer"
payload = { "customer_id": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer"
payload <- "{\n \"customer_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"customer_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/gift-cards/:gift_card_id/unlink-customer') do |req|
req.body = "{\n \"customer_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer";
let payload = json!({"customer_id": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer \
--header 'content-type: application/json' \
--data '{
"customer_id": ""
}'
echo '{
"customer_id": ""
}' | \
http POST {{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "customer_id": ""\n}' \
--output-document \
- {{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["customer_id": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/gift-cards/:gift_card_id/unlink-customer")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"gift_card": {
"balance_money": {
"amount": 2500,
"currency": "USD"
},
"created_at": "2021-03-25T05:13:01Z",
"gan": "7783320005440920",
"gan_source": "SQUARE",
"id": "gftc:71ea002277a34f8a945e284b04822edb",
"state": "ACTIVE",
"type": "DIGITAL"
}
}
POST
BatchChangeInventory
{{baseUrl}}/v2/inventory/changes/batch-create
BODY json
{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/changes/batch-create");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/inventory/changes/batch-create" {:content-type :json
:form-params {:changes [{:adjustment {:adjustment_group {:from_state ""
:id ""
:root_adjustment_id ""
:to_state ""}
:catalog_object_id ""
:catalog_object_type ""
:created_at ""
:employee_id ""
:from_state ""
:goods_receipt_id ""
:id ""
:location_id ""
:occurred_at ""
:purchase_order_id ""
:quantity ""
:reference_id ""
:refund_id ""
:source {:application_id ""
:name ""
:product ""}
:to_state ""
:total_price_money {:amount 0
:currency ""}
:transaction_id ""}
:measurement_unit {:measurement_unit {:area_unit ""
:custom_unit {:abbreviation ""
:name ""}
:generic_unit ""
:length_unit ""
:time_unit ""
:type ""
:volume_unit ""
:weight_unit ""}
:precision 0}
:measurement_unit_id ""
:physical_count {:catalog_object_id ""
:catalog_object_type ""
:created_at ""
:employee_id ""
:id ""
:location_id ""
:occurred_at ""
:quantity ""
:reference_id ""
:source {}
:state ""}
:transfer {:catalog_object_id ""
:catalog_object_type ""
:created_at ""
:employee_id ""
:from_location_id ""
:id ""
:occurred_at ""
:quantity ""
:reference_id ""
:source {}
:state ""
:to_location_id ""}
:type ""}]
:idempotency_key ""
:ignore_unchanged_counts false}})
require "http/client"
url = "{{baseUrl}}/v2/inventory/changes/batch-create"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/changes/batch-create"),
Content = new StringContent("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/changes/batch-create");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/changes/batch-create"
payload := strings.NewReader("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/inventory/changes/batch-create HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2000
{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/inventory/changes/batch-create")
.setHeader("content-type", "application/json")
.setBody("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/changes/batch-create"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/changes/batch-create")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/inventory/changes/batch-create")
.header("content-type", "application/json")
.body("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
.asString();
const data = JSON.stringify({
changes: [
{
adjustment: {
adjustment_group: {
from_state: '',
id: '',
root_adjustment_id: '',
to_state: ''
},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {
application_id: '',
name: '',
product: ''
},
to_state: '',
total_price_money: {
amount: 0,
currency: ''
},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/inventory/changes/batch-create');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/changes/batch-create',
headers: {'content-type': 'application/json'},
data: {
changes: [
{
adjustment: {
adjustment_group: {from_state: '', id: '', root_adjustment_id: '', to_state: ''},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {application_id: '', name: '', product: ''},
to_state: '',
total_price_money: {amount: 0, currency: ''},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/changes/batch-create';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"changes":[{"adjustment":{"adjustment_group":{"from_state":"","id":"","root_adjustment_id":"","to_state":""},"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","from_state":"","goods_receipt_id":"","id":"","location_id":"","occurred_at":"","purchase_order_id":"","quantity":"","reference_id":"","refund_id":"","source":{"application_id":"","name":"","product":""},"to_state":"","total_price_money":{"amount":0,"currency":""},"transaction_id":""},"measurement_unit":{"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"measurement_unit_id":"","physical_count":{"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","id":"","location_id":"","occurred_at":"","quantity":"","reference_id":"","source":{},"state":""},"transfer":{"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","from_location_id":"","id":"","occurred_at":"","quantity":"","reference_id":"","source":{},"state":"","to_location_id":""},"type":""}],"idempotency_key":"","ignore_unchanged_counts":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/changes/batch-create',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "changes": [\n {\n "adjustment": {\n "adjustment_group": {\n "from_state": "",\n "id": "",\n "root_adjustment_id": "",\n "to_state": ""\n },\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "from_state": "",\n "goods_receipt_id": "",\n "id": "",\n "location_id": "",\n "occurred_at": "",\n "purchase_order_id": "",\n "quantity": "",\n "reference_id": "",\n "refund_id": "",\n "source": {\n "application_id": "",\n "name": "",\n "product": ""\n },\n "to_state": "",\n "total_price_money": {\n "amount": 0,\n "currency": ""\n },\n "transaction_id": ""\n },\n "measurement_unit": {\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "measurement_unit_id": "",\n "physical_count": {\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "id": "",\n "location_id": "",\n "occurred_at": "",\n "quantity": "",\n "reference_id": "",\n "source": {},\n "state": ""\n },\n "transfer": {\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "from_location_id": "",\n "id": "",\n "occurred_at": "",\n "quantity": "",\n "reference_id": "",\n "source": {},\n "state": "",\n "to_location_id": ""\n },\n "type": ""\n }\n ],\n "idempotency_key": "",\n "ignore_unchanged_counts": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/changes/batch-create")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/changes/batch-create',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
changes: [
{
adjustment: {
adjustment_group: {from_state: '', id: '', root_adjustment_id: '', to_state: ''},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {application_id: '', name: '', product: ''},
to_state: '',
total_price_money: {amount: 0, currency: ''},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/changes/batch-create',
headers: {'content-type': 'application/json'},
body: {
changes: [
{
adjustment: {
adjustment_group: {from_state: '', id: '', root_adjustment_id: '', to_state: ''},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {application_id: '', name: '', product: ''},
to_state: '',
total_price_money: {amount: 0, currency: ''},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/inventory/changes/batch-create');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
changes: [
{
adjustment: {
adjustment_group: {
from_state: '',
id: '',
root_adjustment_id: '',
to_state: ''
},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {
application_id: '',
name: '',
product: ''
},
to_state: '',
total_price_money: {
amount: 0,
currency: ''
},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/changes/batch-create',
headers: {'content-type': 'application/json'},
data: {
changes: [
{
adjustment: {
adjustment_group: {from_state: '', id: '', root_adjustment_id: '', to_state: ''},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {application_id: '', name: '', product: ''},
to_state: '',
total_price_money: {amount: 0, currency: ''},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/changes/batch-create';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"changes":[{"adjustment":{"adjustment_group":{"from_state":"","id":"","root_adjustment_id":"","to_state":""},"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","from_state":"","goods_receipt_id":"","id":"","location_id":"","occurred_at":"","purchase_order_id":"","quantity":"","reference_id":"","refund_id":"","source":{"application_id":"","name":"","product":""},"to_state":"","total_price_money":{"amount":0,"currency":""},"transaction_id":""},"measurement_unit":{"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"measurement_unit_id":"","physical_count":{"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","id":"","location_id":"","occurred_at":"","quantity":"","reference_id":"","source":{},"state":""},"transfer":{"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","from_location_id":"","id":"","occurred_at":"","quantity":"","reference_id":"","source":{},"state":"","to_location_id":""},"type":""}],"idempotency_key":"","ignore_unchanged_counts":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"changes": @[ @{ @"adjustment": @{ @"adjustment_group": @{ @"from_state": @"", @"id": @"", @"root_adjustment_id": @"", @"to_state": @"" }, @"catalog_object_id": @"", @"catalog_object_type": @"", @"created_at": @"", @"employee_id": @"", @"from_state": @"", @"goods_receipt_id": @"", @"id": @"", @"location_id": @"", @"occurred_at": @"", @"purchase_order_id": @"", @"quantity": @"", @"reference_id": @"", @"refund_id": @"", @"source": @{ @"application_id": @"", @"name": @"", @"product": @"" }, @"to_state": @"", @"total_price_money": @{ @"amount": @0, @"currency": @"" }, @"transaction_id": @"" }, @"measurement_unit": @{ @"measurement_unit": @{ @"area_unit": @"", @"custom_unit": @{ @"abbreviation": @"", @"name": @"" }, @"generic_unit": @"", @"length_unit": @"", @"time_unit": @"", @"type": @"", @"volume_unit": @"", @"weight_unit": @"" }, @"precision": @0 }, @"measurement_unit_id": @"", @"physical_count": @{ @"catalog_object_id": @"", @"catalog_object_type": @"", @"created_at": @"", @"employee_id": @"", @"id": @"", @"location_id": @"", @"occurred_at": @"", @"quantity": @"", @"reference_id": @"", @"source": @{ }, @"state": @"" }, @"transfer": @{ @"catalog_object_id": @"", @"catalog_object_type": @"", @"created_at": @"", @"employee_id": @"", @"from_location_id": @"", @"id": @"", @"occurred_at": @"", @"quantity": @"", @"reference_id": @"", @"source": @{ }, @"state": @"", @"to_location_id": @"" }, @"type": @"" } ],
@"idempotency_key": @"",
@"ignore_unchanged_counts": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/changes/batch-create"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/changes/batch-create" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/changes/batch-create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'changes' => [
[
'adjustment' => [
'adjustment_group' => [
'from_state' => '',
'id' => '',
'root_adjustment_id' => '',
'to_state' => ''
],
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_state' => '',
'goods_receipt_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'purchase_order_id' => '',
'quantity' => '',
'reference_id' => '',
'refund_id' => '',
'source' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'to_state' => '',
'total_price_money' => [
'amount' => 0,
'currency' => ''
],
'transaction_id' => ''
],
'measurement_unit' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'measurement_unit_id' => '',
'physical_count' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => ''
],
'transfer' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_location_id' => '',
'id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => '',
'to_location_id' => ''
],
'type' => ''
]
],
'idempotency_key' => '',
'ignore_unchanged_counts' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/inventory/changes/batch-create', [
'body' => '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/changes/batch-create');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'changes' => [
[
'adjustment' => [
'adjustment_group' => [
'from_state' => '',
'id' => '',
'root_adjustment_id' => '',
'to_state' => ''
],
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_state' => '',
'goods_receipt_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'purchase_order_id' => '',
'quantity' => '',
'reference_id' => '',
'refund_id' => '',
'source' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'to_state' => '',
'total_price_money' => [
'amount' => 0,
'currency' => ''
],
'transaction_id' => ''
],
'measurement_unit' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'measurement_unit_id' => '',
'physical_count' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => ''
],
'transfer' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_location_id' => '',
'id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => '',
'to_location_id' => ''
],
'type' => ''
]
],
'idempotency_key' => '',
'ignore_unchanged_counts' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'changes' => [
[
'adjustment' => [
'adjustment_group' => [
'from_state' => '',
'id' => '',
'root_adjustment_id' => '',
'to_state' => ''
],
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_state' => '',
'goods_receipt_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'purchase_order_id' => '',
'quantity' => '',
'reference_id' => '',
'refund_id' => '',
'source' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'to_state' => '',
'total_price_money' => [
'amount' => 0,
'currency' => ''
],
'transaction_id' => ''
],
'measurement_unit' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'measurement_unit_id' => '',
'physical_count' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => ''
],
'transfer' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_location_id' => '',
'id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => '',
'to_location_id' => ''
],
'type' => ''
]
],
'idempotency_key' => '',
'ignore_unchanged_counts' => null
]));
$request->setRequestUrl('{{baseUrl}}/v2/inventory/changes/batch-create');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/changes/batch-create' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/changes/batch-create' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/inventory/changes/batch-create", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/changes/batch-create"
payload = {
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/changes/batch-create"
payload <- "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/changes/batch-create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/inventory/changes/batch-create') do |req|
req.body = "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/changes/batch-create";
let payload = json!({
"changes": (
json!({
"adjustment": json!({
"adjustment_group": json!({
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
}),
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": json!({
"application_id": "",
"name": "",
"product": ""
}),
"to_state": "",
"total_price_money": json!({
"amount": 0,
"currency": ""
}),
"transaction_id": ""
}),
"measurement_unit": json!({
"measurement_unit": json!({
"area_unit": "",
"custom_unit": json!({
"abbreviation": "",
"name": ""
}),
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
}),
"precision": 0
}),
"measurement_unit_id": "",
"physical_count": json!({
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": json!({}),
"state": ""
}),
"transfer": json!({
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": json!({}),
"state": "",
"to_location_id": ""
}),
"type": ""
})
),
"idempotency_key": "",
"ignore_unchanged_counts": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/inventory/changes/batch-create \
--header 'content-type: application/json' \
--data '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}'
echo '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}' | \
http POST {{baseUrl}}/v2/inventory/changes/batch-create \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "changes": [\n {\n "adjustment": {\n "adjustment_group": {\n "from_state": "",\n "id": "",\n "root_adjustment_id": "",\n "to_state": ""\n },\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "from_state": "",\n "goods_receipt_id": "",\n "id": "",\n "location_id": "",\n "occurred_at": "",\n "purchase_order_id": "",\n "quantity": "",\n "reference_id": "",\n "refund_id": "",\n "source": {\n "application_id": "",\n "name": "",\n "product": ""\n },\n "to_state": "",\n "total_price_money": {\n "amount": 0,\n "currency": ""\n },\n "transaction_id": ""\n },\n "measurement_unit": {\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "measurement_unit_id": "",\n "physical_count": {\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "id": "",\n "location_id": "",\n "occurred_at": "",\n "quantity": "",\n "reference_id": "",\n "source": {},\n "state": ""\n },\n "transfer": {\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "from_location_id": "",\n "id": "",\n "occurred_at": "",\n "quantity": "",\n "reference_id": "",\n "source": {},\n "state": "",\n "to_location_id": ""\n },\n "type": ""\n }\n ],\n "idempotency_key": "",\n "ignore_unchanged_counts": false\n}' \
--output-document \
- {{baseUrl}}/v2/inventory/changes/batch-create
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"changes": [
[
"adjustment": [
"adjustment_group": [
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
],
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": [
"application_id": "",
"name": "",
"product": ""
],
"to_state": "",
"total_price_money": [
"amount": 0,
"currency": ""
],
"transaction_id": ""
],
"measurement_unit": [
"measurement_unit": [
"area_unit": "",
"custom_unit": [
"abbreviation": "",
"name": ""
],
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
],
"precision": 0
],
"measurement_unit_id": "",
"physical_count": [
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": [],
"state": ""
],
"transfer": [
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": [],
"state": "",
"to_location_id": ""
],
"type": ""
]
],
"idempotency_key": "",
"ignore_unchanged_counts": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/changes/batch-create")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"counts": [
{
"calculated_at": "2016-11-16T22:28:01.223Z",
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"location_id": "C6W5YS5QM06F5",
"quantity": "53",
"state": "IN_STOCK"
}
],
"errors": []
}
POST
BatchRetrieveInventoryChanges
{{baseUrl}}/v2/inventory/changes/batch-retrieve
BODY json
{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/changes/batch-retrieve");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/inventory/changes/batch-retrieve" {:content-type :json
:form-params {:catalog_object_ids []
:cursor ""
:location_ids []
:states []
:types []
:updated_after ""
:updated_before ""}})
require "http/client"
url = "{{baseUrl}}/v2/inventory/changes/batch-retrieve"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/changes/batch-retrieve"),
Content = new StringContent("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/changes/batch-retrieve");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/changes/batch-retrieve"
payload := strings.NewReader("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/inventory/changes/batch-retrieve HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 146
{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/inventory/changes/batch-retrieve")
.setHeader("content-type", "application/json")
.setBody("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/changes/batch-retrieve"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/changes/batch-retrieve")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/inventory/changes/batch-retrieve")
.header("content-type", "application/json")
.body("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
.asString();
const data = JSON.stringify({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/inventory/changes/batch-retrieve');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/changes/batch-retrieve',
headers: {'content-type': 'application/json'},
data: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/changes/batch-retrieve';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_object_ids":[],"cursor":"","location_ids":[],"states":[],"types":[],"updated_after":"","updated_before":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/changes/batch-retrieve',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "catalog_object_ids": [],\n "cursor": "",\n "location_ids": [],\n "states": [],\n "types": [],\n "updated_after": "",\n "updated_before": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/changes/batch-retrieve")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/changes/batch-retrieve',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/changes/batch-retrieve',
headers: {'content-type': 'application/json'},
body: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/inventory/changes/batch-retrieve');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/changes/batch-retrieve',
headers: {'content-type': 'application/json'},
data: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/changes/batch-retrieve';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_object_ids":[],"cursor":"","location_ids":[],"states":[],"types":[],"updated_after":"","updated_before":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"catalog_object_ids": @[ ],
@"cursor": @"",
@"location_ids": @[ ],
@"states": @[ ],
@"types": @[ ],
@"updated_after": @"",
@"updated_before": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/changes/batch-retrieve"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/changes/batch-retrieve" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/changes/batch-retrieve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'types' => [
],
'updated_after' => '',
'updated_before' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/inventory/changes/batch-retrieve', [
'body' => '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/changes/batch-retrieve');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'types' => [
],
'updated_after' => '',
'updated_before' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'types' => [
],
'updated_after' => '',
'updated_before' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/inventory/changes/batch-retrieve');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/changes/batch-retrieve' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/changes/batch-retrieve' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/inventory/changes/batch-retrieve", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/changes/batch-retrieve"
payload = {
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/changes/batch-retrieve"
payload <- "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/changes/batch-retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/inventory/changes/batch-retrieve') do |req|
req.body = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/changes/batch-retrieve";
let payload = json!({
"catalog_object_ids": (),
"cursor": "",
"location_ids": (),
"states": (),
"types": (),
"updated_after": "",
"updated_before": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/inventory/changes/batch-retrieve \
--header 'content-type: application/json' \
--data '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}'
echo '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}' | \
http POST {{baseUrl}}/v2/inventory/changes/batch-retrieve \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "catalog_object_ids": [],\n "cursor": "",\n "location_ids": [],\n "states": [],\n "types": [],\n "updated_after": "",\n "updated_before": ""\n}' \
--output-document \
- {{baseUrl}}/v2/inventory/changes/batch-retrieve
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/changes/batch-retrieve")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"changes": [
{
"physical_count": {
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"created_at": "2016-11-16T22:25:24.878Z",
"employee_id": "LRK57NSQ5X7PUD05",
"id": "46YDTW253DWGGK9HMAE6XCAO",
"location_id": "C6W5YS5QM06F5",
"occurred_at": "2016-11-16T22:24:49.028Z",
"quantity": "86",
"reference_id": "22c07cf4-5626-4224-89f9-691112019399",
"source": {
"application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0",
"name": "Square Point of Sale 4.37",
"product": "SQUARE_POS"
},
"state": "IN_STOCK"
},
"type": "PHYSICAL_COUNT"
}
],
"errors": []
}
POST
BatchRetrieveInventoryCounts
{{baseUrl}}/v2/inventory/counts/batch-retrieve
BODY json
{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/counts/batch-retrieve");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/inventory/counts/batch-retrieve" {:content-type :json
:form-params {:catalog_object_ids []
:cursor ""
:location_ids []
:states []
:updated_after ""}})
require "http/client"
url = "{{baseUrl}}/v2/inventory/counts/batch-retrieve"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/counts/batch-retrieve"),
Content = new StringContent("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/counts/batch-retrieve");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/counts/batch-retrieve"
payload := strings.NewReader("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/inventory/counts/batch-retrieve HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 107
{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/inventory/counts/batch-retrieve")
.setHeader("content-type", "application/json")
.setBody("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/counts/batch-retrieve"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/counts/batch-retrieve")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/inventory/counts/batch-retrieve")
.header("content-type", "application/json")
.body("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
.asString();
const data = JSON.stringify({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/inventory/counts/batch-retrieve');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/counts/batch-retrieve',
headers: {'content-type': 'application/json'},
data: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/counts/batch-retrieve';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_object_ids":[],"cursor":"","location_ids":[],"states":[],"updated_after":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/counts/batch-retrieve',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "catalog_object_ids": [],\n "cursor": "",\n "location_ids": [],\n "states": [],\n "updated_after": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/counts/batch-retrieve")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/counts/batch-retrieve',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/counts/batch-retrieve',
headers: {'content-type': 'application/json'},
body: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/inventory/counts/batch-retrieve');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/counts/batch-retrieve',
headers: {'content-type': 'application/json'},
data: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/counts/batch-retrieve';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_object_ids":[],"cursor":"","location_ids":[],"states":[],"updated_after":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"catalog_object_ids": @[ ],
@"cursor": @"",
@"location_ids": @[ ],
@"states": @[ ],
@"updated_after": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/counts/batch-retrieve"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/counts/batch-retrieve" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/counts/batch-retrieve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'updated_after' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/inventory/counts/batch-retrieve', [
'body' => '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/counts/batch-retrieve');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'updated_after' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'updated_after' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/inventory/counts/batch-retrieve');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/counts/batch-retrieve' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/counts/batch-retrieve' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/inventory/counts/batch-retrieve", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/counts/batch-retrieve"
payload = {
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/counts/batch-retrieve"
payload <- "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/counts/batch-retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/inventory/counts/batch-retrieve') do |req|
req.body = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/counts/batch-retrieve";
let payload = json!({
"catalog_object_ids": (),
"cursor": "",
"location_ids": (),
"states": (),
"updated_after": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/inventory/counts/batch-retrieve \
--header 'content-type: application/json' \
--data '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}'
echo '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}' | \
http POST {{baseUrl}}/v2/inventory/counts/batch-retrieve \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "catalog_object_ids": [],\n "cursor": "",\n "location_ids": [],\n "states": [],\n "updated_after": ""\n}' \
--output-document \
- {{baseUrl}}/v2/inventory/counts/batch-retrieve
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/counts/batch-retrieve")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"counts": [
{
"calculated_at": "2016-11-16T22:28:01.223Z",
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"location_id": "59TNP9SA8VGDA",
"quantity": "79",
"state": "IN_STOCK"
}
],
"errors": []
}
POST
DeprecatedBatchChangeInventory
{{baseUrl}}/v2/inventory/batch-change
BODY json
{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/batch-change");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/inventory/batch-change" {:content-type :json
:form-params {:changes [{:adjustment {:adjustment_group {:from_state ""
:id ""
:root_adjustment_id ""
:to_state ""}
:catalog_object_id ""
:catalog_object_type ""
:created_at ""
:employee_id ""
:from_state ""
:goods_receipt_id ""
:id ""
:location_id ""
:occurred_at ""
:purchase_order_id ""
:quantity ""
:reference_id ""
:refund_id ""
:source {:application_id ""
:name ""
:product ""}
:to_state ""
:total_price_money {:amount 0
:currency ""}
:transaction_id ""}
:measurement_unit {:measurement_unit {:area_unit ""
:custom_unit {:abbreviation ""
:name ""}
:generic_unit ""
:length_unit ""
:time_unit ""
:type ""
:volume_unit ""
:weight_unit ""}
:precision 0}
:measurement_unit_id ""
:physical_count {:catalog_object_id ""
:catalog_object_type ""
:created_at ""
:employee_id ""
:id ""
:location_id ""
:occurred_at ""
:quantity ""
:reference_id ""
:source {}
:state ""}
:transfer {:catalog_object_id ""
:catalog_object_type ""
:created_at ""
:employee_id ""
:from_location_id ""
:id ""
:occurred_at ""
:quantity ""
:reference_id ""
:source {}
:state ""
:to_location_id ""}
:type ""}]
:idempotency_key ""
:ignore_unchanged_counts false}})
require "http/client"
url = "{{baseUrl}}/v2/inventory/batch-change"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/batch-change"),
Content = new StringContent("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/batch-change");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/batch-change"
payload := strings.NewReader("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/inventory/batch-change HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2000
{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/inventory/batch-change")
.setHeader("content-type", "application/json")
.setBody("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/batch-change"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/batch-change")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/inventory/batch-change")
.header("content-type", "application/json")
.body("{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
.asString();
const data = JSON.stringify({
changes: [
{
adjustment: {
adjustment_group: {
from_state: '',
id: '',
root_adjustment_id: '',
to_state: ''
},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {
application_id: '',
name: '',
product: ''
},
to_state: '',
total_price_money: {
amount: 0,
currency: ''
},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/inventory/batch-change');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-change',
headers: {'content-type': 'application/json'},
data: {
changes: [
{
adjustment: {
adjustment_group: {from_state: '', id: '', root_adjustment_id: '', to_state: ''},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {application_id: '', name: '', product: ''},
to_state: '',
total_price_money: {amount: 0, currency: ''},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/batch-change';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"changes":[{"adjustment":{"adjustment_group":{"from_state":"","id":"","root_adjustment_id":"","to_state":""},"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","from_state":"","goods_receipt_id":"","id":"","location_id":"","occurred_at":"","purchase_order_id":"","quantity":"","reference_id":"","refund_id":"","source":{"application_id":"","name":"","product":""},"to_state":"","total_price_money":{"amount":0,"currency":""},"transaction_id":""},"measurement_unit":{"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"measurement_unit_id":"","physical_count":{"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","id":"","location_id":"","occurred_at":"","quantity":"","reference_id":"","source":{},"state":""},"transfer":{"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","from_location_id":"","id":"","occurred_at":"","quantity":"","reference_id":"","source":{},"state":"","to_location_id":""},"type":""}],"idempotency_key":"","ignore_unchanged_counts":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/batch-change',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "changes": [\n {\n "adjustment": {\n "adjustment_group": {\n "from_state": "",\n "id": "",\n "root_adjustment_id": "",\n "to_state": ""\n },\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "from_state": "",\n "goods_receipt_id": "",\n "id": "",\n "location_id": "",\n "occurred_at": "",\n "purchase_order_id": "",\n "quantity": "",\n "reference_id": "",\n "refund_id": "",\n "source": {\n "application_id": "",\n "name": "",\n "product": ""\n },\n "to_state": "",\n "total_price_money": {\n "amount": 0,\n "currency": ""\n },\n "transaction_id": ""\n },\n "measurement_unit": {\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "measurement_unit_id": "",\n "physical_count": {\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "id": "",\n "location_id": "",\n "occurred_at": "",\n "quantity": "",\n "reference_id": "",\n "source": {},\n "state": ""\n },\n "transfer": {\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "from_location_id": "",\n "id": "",\n "occurred_at": "",\n "quantity": "",\n "reference_id": "",\n "source": {},\n "state": "",\n "to_location_id": ""\n },\n "type": ""\n }\n ],\n "idempotency_key": "",\n "ignore_unchanged_counts": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/batch-change")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/batch-change',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
changes: [
{
adjustment: {
adjustment_group: {from_state: '', id: '', root_adjustment_id: '', to_state: ''},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {application_id: '', name: '', product: ''},
to_state: '',
total_price_money: {amount: 0, currency: ''},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-change',
headers: {'content-type': 'application/json'},
body: {
changes: [
{
adjustment: {
adjustment_group: {from_state: '', id: '', root_adjustment_id: '', to_state: ''},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {application_id: '', name: '', product: ''},
to_state: '',
total_price_money: {amount: 0, currency: ''},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/inventory/batch-change');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
changes: [
{
adjustment: {
adjustment_group: {
from_state: '',
id: '',
root_adjustment_id: '',
to_state: ''
},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {
application_id: '',
name: '',
product: ''
},
to_state: '',
total_price_money: {
amount: 0,
currency: ''
},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-change',
headers: {'content-type': 'application/json'},
data: {
changes: [
{
adjustment: {
adjustment_group: {from_state: '', id: '', root_adjustment_id: '', to_state: ''},
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_state: '',
goods_receipt_id: '',
id: '',
location_id: '',
occurred_at: '',
purchase_order_id: '',
quantity: '',
reference_id: '',
refund_id: '',
source: {application_id: '', name: '', product: ''},
to_state: '',
total_price_money: {amount: 0, currency: ''},
transaction_id: ''
},
measurement_unit: {
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
measurement_unit_id: '',
physical_count: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
id: '',
location_id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: ''
},
transfer: {
catalog_object_id: '',
catalog_object_type: '',
created_at: '',
employee_id: '',
from_location_id: '',
id: '',
occurred_at: '',
quantity: '',
reference_id: '',
source: {},
state: '',
to_location_id: ''
},
type: ''
}
],
idempotency_key: '',
ignore_unchanged_counts: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/batch-change';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"changes":[{"adjustment":{"adjustment_group":{"from_state":"","id":"","root_adjustment_id":"","to_state":""},"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","from_state":"","goods_receipt_id":"","id":"","location_id":"","occurred_at":"","purchase_order_id":"","quantity":"","reference_id":"","refund_id":"","source":{"application_id":"","name":"","product":""},"to_state":"","total_price_money":{"amount":0,"currency":""},"transaction_id":""},"measurement_unit":{"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"measurement_unit_id":"","physical_count":{"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","id":"","location_id":"","occurred_at":"","quantity":"","reference_id":"","source":{},"state":""},"transfer":{"catalog_object_id":"","catalog_object_type":"","created_at":"","employee_id":"","from_location_id":"","id":"","occurred_at":"","quantity":"","reference_id":"","source":{},"state":"","to_location_id":""},"type":""}],"idempotency_key":"","ignore_unchanged_counts":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"changes": @[ @{ @"adjustment": @{ @"adjustment_group": @{ @"from_state": @"", @"id": @"", @"root_adjustment_id": @"", @"to_state": @"" }, @"catalog_object_id": @"", @"catalog_object_type": @"", @"created_at": @"", @"employee_id": @"", @"from_state": @"", @"goods_receipt_id": @"", @"id": @"", @"location_id": @"", @"occurred_at": @"", @"purchase_order_id": @"", @"quantity": @"", @"reference_id": @"", @"refund_id": @"", @"source": @{ @"application_id": @"", @"name": @"", @"product": @"" }, @"to_state": @"", @"total_price_money": @{ @"amount": @0, @"currency": @"" }, @"transaction_id": @"" }, @"measurement_unit": @{ @"measurement_unit": @{ @"area_unit": @"", @"custom_unit": @{ @"abbreviation": @"", @"name": @"" }, @"generic_unit": @"", @"length_unit": @"", @"time_unit": @"", @"type": @"", @"volume_unit": @"", @"weight_unit": @"" }, @"precision": @0 }, @"measurement_unit_id": @"", @"physical_count": @{ @"catalog_object_id": @"", @"catalog_object_type": @"", @"created_at": @"", @"employee_id": @"", @"id": @"", @"location_id": @"", @"occurred_at": @"", @"quantity": @"", @"reference_id": @"", @"source": @{ }, @"state": @"" }, @"transfer": @{ @"catalog_object_id": @"", @"catalog_object_type": @"", @"created_at": @"", @"employee_id": @"", @"from_location_id": @"", @"id": @"", @"occurred_at": @"", @"quantity": @"", @"reference_id": @"", @"source": @{ }, @"state": @"", @"to_location_id": @"" }, @"type": @"" } ],
@"idempotency_key": @"",
@"ignore_unchanged_counts": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/batch-change"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/batch-change" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/batch-change",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'changes' => [
[
'adjustment' => [
'adjustment_group' => [
'from_state' => '',
'id' => '',
'root_adjustment_id' => '',
'to_state' => ''
],
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_state' => '',
'goods_receipt_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'purchase_order_id' => '',
'quantity' => '',
'reference_id' => '',
'refund_id' => '',
'source' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'to_state' => '',
'total_price_money' => [
'amount' => 0,
'currency' => ''
],
'transaction_id' => ''
],
'measurement_unit' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'measurement_unit_id' => '',
'physical_count' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => ''
],
'transfer' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_location_id' => '',
'id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => '',
'to_location_id' => ''
],
'type' => ''
]
],
'idempotency_key' => '',
'ignore_unchanged_counts' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/inventory/batch-change', [
'body' => '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/batch-change');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'changes' => [
[
'adjustment' => [
'adjustment_group' => [
'from_state' => '',
'id' => '',
'root_adjustment_id' => '',
'to_state' => ''
],
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_state' => '',
'goods_receipt_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'purchase_order_id' => '',
'quantity' => '',
'reference_id' => '',
'refund_id' => '',
'source' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'to_state' => '',
'total_price_money' => [
'amount' => 0,
'currency' => ''
],
'transaction_id' => ''
],
'measurement_unit' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'measurement_unit_id' => '',
'physical_count' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => ''
],
'transfer' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_location_id' => '',
'id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => '',
'to_location_id' => ''
],
'type' => ''
]
],
'idempotency_key' => '',
'ignore_unchanged_counts' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'changes' => [
[
'adjustment' => [
'adjustment_group' => [
'from_state' => '',
'id' => '',
'root_adjustment_id' => '',
'to_state' => ''
],
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_state' => '',
'goods_receipt_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'purchase_order_id' => '',
'quantity' => '',
'reference_id' => '',
'refund_id' => '',
'source' => [
'application_id' => '',
'name' => '',
'product' => ''
],
'to_state' => '',
'total_price_money' => [
'amount' => 0,
'currency' => ''
],
'transaction_id' => ''
],
'measurement_unit' => [
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'measurement_unit_id' => '',
'physical_count' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'id' => '',
'location_id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => ''
],
'transfer' => [
'catalog_object_id' => '',
'catalog_object_type' => '',
'created_at' => '',
'employee_id' => '',
'from_location_id' => '',
'id' => '',
'occurred_at' => '',
'quantity' => '',
'reference_id' => '',
'source' => [
],
'state' => '',
'to_location_id' => ''
],
'type' => ''
]
],
'idempotency_key' => '',
'ignore_unchanged_counts' => null
]));
$request->setRequestUrl('{{baseUrl}}/v2/inventory/batch-change');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/batch-change' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/batch-change' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/inventory/batch-change", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/batch-change"
payload = {
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/batch-change"
payload <- "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/batch-change")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/inventory/batch-change') do |req|
req.body = "{\n \"changes\": [\n {\n \"adjustment\": {\n \"adjustment_group\": {\n \"from_state\": \"\",\n \"id\": \"\",\n \"root_adjustment_id\": \"\",\n \"to_state\": \"\"\n },\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_state\": \"\",\n \"goods_receipt_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"purchase_order_id\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"refund_id\": \"\",\n \"source\": {\n \"application_id\": \"\",\n \"name\": \"\",\n \"product\": \"\"\n },\n \"to_state\": \"\",\n \"total_price_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"transaction_id\": \"\"\n },\n \"measurement_unit\": {\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"measurement_unit_id\": \"\",\n \"physical_count\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\"\n },\n \"transfer\": {\n \"catalog_object_id\": \"\",\n \"catalog_object_type\": \"\",\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"from_location_id\": \"\",\n \"id\": \"\",\n \"occurred_at\": \"\",\n \"quantity\": \"\",\n \"reference_id\": \"\",\n \"source\": {},\n \"state\": \"\",\n \"to_location_id\": \"\"\n },\n \"type\": \"\"\n }\n ],\n \"idempotency_key\": \"\",\n \"ignore_unchanged_counts\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/batch-change";
let payload = json!({
"changes": (
json!({
"adjustment": json!({
"adjustment_group": json!({
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
}),
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": json!({
"application_id": "",
"name": "",
"product": ""
}),
"to_state": "",
"total_price_money": json!({
"amount": 0,
"currency": ""
}),
"transaction_id": ""
}),
"measurement_unit": json!({
"measurement_unit": json!({
"area_unit": "",
"custom_unit": json!({
"abbreviation": "",
"name": ""
}),
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
}),
"precision": 0
}),
"measurement_unit_id": "",
"physical_count": json!({
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": json!({}),
"state": ""
}),
"transfer": json!({
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": json!({}),
"state": "",
"to_location_id": ""
}),
"type": ""
})
),
"idempotency_key": "",
"ignore_unchanged_counts": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/inventory/batch-change \
--header 'content-type: application/json' \
--data '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}'
echo '{
"changes": [
{
"adjustment": {
"adjustment_group": {
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
},
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": {
"application_id": "",
"name": "",
"product": ""
},
"to_state": "",
"total_price_money": {
"amount": 0,
"currency": ""
},
"transaction_id": ""
},
"measurement_unit": {
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"measurement_unit_id": "",
"physical_count": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": ""
},
"transfer": {
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": {},
"state": "",
"to_location_id": ""
},
"type": ""
}
],
"idempotency_key": "",
"ignore_unchanged_counts": false
}' | \
http POST {{baseUrl}}/v2/inventory/batch-change \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "changes": [\n {\n "adjustment": {\n "adjustment_group": {\n "from_state": "",\n "id": "",\n "root_adjustment_id": "",\n "to_state": ""\n },\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "from_state": "",\n "goods_receipt_id": "",\n "id": "",\n "location_id": "",\n "occurred_at": "",\n "purchase_order_id": "",\n "quantity": "",\n "reference_id": "",\n "refund_id": "",\n "source": {\n "application_id": "",\n "name": "",\n "product": ""\n },\n "to_state": "",\n "total_price_money": {\n "amount": 0,\n "currency": ""\n },\n "transaction_id": ""\n },\n "measurement_unit": {\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "measurement_unit_id": "",\n "physical_count": {\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "id": "",\n "location_id": "",\n "occurred_at": "",\n "quantity": "",\n "reference_id": "",\n "source": {},\n "state": ""\n },\n "transfer": {\n "catalog_object_id": "",\n "catalog_object_type": "",\n "created_at": "",\n "employee_id": "",\n "from_location_id": "",\n "id": "",\n "occurred_at": "",\n "quantity": "",\n "reference_id": "",\n "source": {},\n "state": "",\n "to_location_id": ""\n },\n "type": ""\n }\n ],\n "idempotency_key": "",\n "ignore_unchanged_counts": false\n}' \
--output-document \
- {{baseUrl}}/v2/inventory/batch-change
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"changes": [
[
"adjustment": [
"adjustment_group": [
"from_state": "",
"id": "",
"root_adjustment_id": "",
"to_state": ""
],
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_state": "",
"goods_receipt_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"purchase_order_id": "",
"quantity": "",
"reference_id": "",
"refund_id": "",
"source": [
"application_id": "",
"name": "",
"product": ""
],
"to_state": "",
"total_price_money": [
"amount": 0,
"currency": ""
],
"transaction_id": ""
],
"measurement_unit": [
"measurement_unit": [
"area_unit": "",
"custom_unit": [
"abbreviation": "",
"name": ""
],
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
],
"precision": 0
],
"measurement_unit_id": "",
"physical_count": [
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"id": "",
"location_id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": [],
"state": ""
],
"transfer": [
"catalog_object_id": "",
"catalog_object_type": "",
"created_at": "",
"employee_id": "",
"from_location_id": "",
"id": "",
"occurred_at": "",
"quantity": "",
"reference_id": "",
"source": [],
"state": "",
"to_location_id": ""
],
"type": ""
]
],
"idempotency_key": "",
"ignore_unchanged_counts": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/batch-change")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"counts": [
{
"calculated_at": "2016-11-16T22:28:01.223Z",
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"location_id": "C6W5YS5QM06F5",
"quantity": "53",
"state": "IN_STOCK"
}
],
"errors": []
}
POST
DeprecatedBatchRetrieveInventoryChanges
{{baseUrl}}/v2/inventory/batch-retrieve-changes
BODY json
{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/batch-retrieve-changes");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/inventory/batch-retrieve-changes" {:content-type :json
:form-params {:catalog_object_ids []
:cursor ""
:location_ids []
:states []
:types []
:updated_after ""
:updated_before ""}})
require "http/client"
url = "{{baseUrl}}/v2/inventory/batch-retrieve-changes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/batch-retrieve-changes"),
Content = new StringContent("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/batch-retrieve-changes");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/batch-retrieve-changes"
payload := strings.NewReader("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/inventory/batch-retrieve-changes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 146
{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/inventory/batch-retrieve-changes")
.setHeader("content-type", "application/json")
.setBody("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/batch-retrieve-changes"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/batch-retrieve-changes")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/inventory/batch-retrieve-changes")
.header("content-type", "application/json")
.body("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
.asString();
const data = JSON.stringify({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/inventory/batch-retrieve-changes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-retrieve-changes',
headers: {'content-type': 'application/json'},
data: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/batch-retrieve-changes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_object_ids":[],"cursor":"","location_ids":[],"states":[],"types":[],"updated_after":"","updated_before":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/batch-retrieve-changes',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "catalog_object_ids": [],\n "cursor": "",\n "location_ids": [],\n "states": [],\n "types": [],\n "updated_after": "",\n "updated_before": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/batch-retrieve-changes")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/batch-retrieve-changes',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-retrieve-changes',
headers: {'content-type': 'application/json'},
body: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/inventory/batch-retrieve-changes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-retrieve-changes',
headers: {'content-type': 'application/json'},
data: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
types: [],
updated_after: '',
updated_before: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/batch-retrieve-changes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_object_ids":[],"cursor":"","location_ids":[],"states":[],"types":[],"updated_after":"","updated_before":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"catalog_object_ids": @[ ],
@"cursor": @"",
@"location_ids": @[ ],
@"states": @[ ],
@"types": @[ ],
@"updated_after": @"",
@"updated_before": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/batch-retrieve-changes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/batch-retrieve-changes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/batch-retrieve-changes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'types' => [
],
'updated_after' => '',
'updated_before' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/inventory/batch-retrieve-changes', [
'body' => '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/batch-retrieve-changes');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'types' => [
],
'updated_after' => '',
'updated_before' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'types' => [
],
'updated_after' => '',
'updated_before' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/inventory/batch-retrieve-changes');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/batch-retrieve-changes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/batch-retrieve-changes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/inventory/batch-retrieve-changes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/batch-retrieve-changes"
payload = {
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/batch-retrieve-changes"
payload <- "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/batch-retrieve-changes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/inventory/batch-retrieve-changes') do |req|
req.body = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"types\": [],\n \"updated_after\": \"\",\n \"updated_before\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/batch-retrieve-changes";
let payload = json!({
"catalog_object_ids": (),
"cursor": "",
"location_ids": (),
"states": (),
"types": (),
"updated_after": "",
"updated_before": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/inventory/batch-retrieve-changes \
--header 'content-type: application/json' \
--data '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}'
echo '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
}' | \
http POST {{baseUrl}}/v2/inventory/batch-retrieve-changes \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "catalog_object_ids": [],\n "cursor": "",\n "location_ids": [],\n "states": [],\n "types": [],\n "updated_after": "",\n "updated_before": ""\n}' \
--output-document \
- {{baseUrl}}/v2/inventory/batch-retrieve-changes
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"types": [],
"updated_after": "",
"updated_before": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/batch-retrieve-changes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"changes": [
{
"physical_count": {
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"created_at": "2016-11-16T22:25:24.878Z",
"employee_id": "LRK57NSQ5X7PUD05",
"id": "46YDTW253DWGGK9HMAE6XCAO",
"location_id": "C6W5YS5QM06F5",
"occurred_at": "2016-11-16T22:24:49.028Z",
"quantity": "86",
"reference_id": "22c07cf4-5626-4224-89f9-691112019399",
"source": {
"application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0",
"name": "Square Point of Sale 4.37",
"product": "SQUARE_POS"
},
"state": "IN_STOCK"
},
"type": "PHYSICAL_COUNT"
}
],
"errors": []
}
POST
DeprecatedBatchRetrieveInventoryCounts
{{baseUrl}}/v2/inventory/batch-retrieve-counts
BODY json
{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/batch-retrieve-counts");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/inventory/batch-retrieve-counts" {:content-type :json
:form-params {:catalog_object_ids []
:cursor ""
:location_ids []
:states []
:updated_after ""}})
require "http/client"
url = "{{baseUrl}}/v2/inventory/batch-retrieve-counts"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/batch-retrieve-counts"),
Content = new StringContent("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/batch-retrieve-counts");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/batch-retrieve-counts"
payload := strings.NewReader("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/inventory/batch-retrieve-counts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 107
{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/inventory/batch-retrieve-counts")
.setHeader("content-type", "application/json")
.setBody("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/batch-retrieve-counts"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/batch-retrieve-counts")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/inventory/batch-retrieve-counts")
.header("content-type", "application/json")
.body("{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
.asString();
const data = JSON.stringify({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/inventory/batch-retrieve-counts');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-retrieve-counts',
headers: {'content-type': 'application/json'},
data: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/batch-retrieve-counts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_object_ids":[],"cursor":"","location_ids":[],"states":[],"updated_after":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/batch-retrieve-counts',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "catalog_object_ids": [],\n "cursor": "",\n "location_ids": [],\n "states": [],\n "updated_after": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/batch-retrieve-counts")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/batch-retrieve-counts',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-retrieve-counts',
headers: {'content-type': 'application/json'},
body: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/inventory/batch-retrieve-counts');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/inventory/batch-retrieve-counts',
headers: {'content-type': 'application/json'},
data: {
catalog_object_ids: [],
cursor: '',
location_ids: [],
states: [],
updated_after: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/batch-retrieve-counts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"catalog_object_ids":[],"cursor":"","location_ids":[],"states":[],"updated_after":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"catalog_object_ids": @[ ],
@"cursor": @"",
@"location_ids": @[ ],
@"states": @[ ],
@"updated_after": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/batch-retrieve-counts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/batch-retrieve-counts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/batch-retrieve-counts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'updated_after' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/inventory/batch-retrieve-counts', [
'body' => '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/batch-retrieve-counts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'updated_after' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'catalog_object_ids' => [
],
'cursor' => '',
'location_ids' => [
],
'states' => [
],
'updated_after' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/inventory/batch-retrieve-counts');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/batch-retrieve-counts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/batch-retrieve-counts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/inventory/batch-retrieve-counts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/batch-retrieve-counts"
payload = {
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/batch-retrieve-counts"
payload <- "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/batch-retrieve-counts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/inventory/batch-retrieve-counts') do |req|
req.body = "{\n \"catalog_object_ids\": [],\n \"cursor\": \"\",\n \"location_ids\": [],\n \"states\": [],\n \"updated_after\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/batch-retrieve-counts";
let payload = json!({
"catalog_object_ids": (),
"cursor": "",
"location_ids": (),
"states": (),
"updated_after": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/inventory/batch-retrieve-counts \
--header 'content-type: application/json' \
--data '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}'
echo '{
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
}' | \
http POST {{baseUrl}}/v2/inventory/batch-retrieve-counts \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "catalog_object_ids": [],\n "cursor": "",\n "location_ids": [],\n "states": [],\n "updated_after": ""\n}' \
--output-document \
- {{baseUrl}}/v2/inventory/batch-retrieve-counts
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"catalog_object_ids": [],
"cursor": "",
"location_ids": [],
"states": [],
"updated_after": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/batch-retrieve-counts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"counts": [
{
"calculated_at": "2016-11-16T22:28:01.223Z",
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"location_id": "59TNP9SA8VGDA",
"quantity": "79",
"state": "IN_STOCK"
}
],
"errors": []
}
GET
DeprecatedRetrieveInventoryAdjustment
{{baseUrl}}/v2/inventory/adjustment/:adjustment_id
QUERY PARAMS
adjustment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id")
require "http/client"
url = "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/adjustment/:adjustment_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/adjustment/:adjustment_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/inventory/adjustment/:adjustment_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/adjustment/:adjustment_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/adjustment/:adjustment_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/inventory/adjustment/:adjustment_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/adjustment/:adjustment_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/adjustment/:adjustment_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/adjustment/:adjustment_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/adjustment/:adjustment_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/adjustment/:adjustment_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/inventory/adjustment/:adjustment_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/adjustment/:adjustment_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/inventory/adjustment/:adjustment_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/adjustment/:adjustment_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/inventory/adjustment/:adjustment_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/inventory/adjustment/:adjustment_id
http GET {{baseUrl}}/v2/inventory/adjustment/:adjustment_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/inventory/adjustment/:adjustment_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/adjustment/:adjustment_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"adjustment": {
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"created_at": "2016-11-17T13:02:15.142Z",
"employee_id": "LRK57NSQ5X7PUD05",
"from_state": "IN_STOCK",
"id": "UDMOEO78BG6GYWA2XDRYX3KB",
"location_id": "C6W5YS5QM06F5",
"occurred_at": "2016-11-16T25:44:22.837Z",
"quantity": "7",
"reference_id": "4a366069-4096-47a2-99a5-0084ac879509",
"source": {
"application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0",
"name": "Square Point of Sale 4.37",
"product": "SQUARE_POS"
},
"to_state": "SOLD",
"total_price_money": {
"amount": 4550,
"currency": "USD"
}
},
"errors": []
}
GET
DeprecatedRetrieveInventoryPhysicalCount
{{baseUrl}}/v2/inventory/physical-count/:physical_count_id
QUERY PARAMS
physical_count_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id")
require "http/client"
url = "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/physical-count/:physical_count_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/physical-count/:physical_count_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/inventory/physical-count/:physical_count_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/physical-count/:physical_count_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/physical-count/:physical_count_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/inventory/physical-count/:physical_count_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/physical-count/:physical_count_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/physical-count/:physical_count_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/physical-count/:physical_count_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/physical-count/:physical_count_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/physical-count/:physical_count_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/inventory/physical-count/:physical_count_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/physical-count/:physical_count_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/inventory/physical-count/:physical_count_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/physical-count/:physical_count_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/inventory/physical-count/:physical_count_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/inventory/physical-count/:physical_count_id
http GET {{baseUrl}}/v2/inventory/physical-count/:physical_count_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/inventory/physical-count/:physical_count_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/physical-count/:physical_count_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"count": {
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"created_at": "2016-11-16T22:25:24.878Z",
"employee_id": "LRK57NSQ5X7PUD05",
"id": "ANZADNPLKADOJKJIUANKLMLQ",
"location_id": "C6W5YS5QM06F5",
"occurred_at": "2016-11-16T22:25:24.878Z",
"quantity": "15",
"reference_id": "f857ec37-f9a0-4458-8e23-5b5e0bea4e53",
"source": {
"application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0",
"name": "Square Point of Sale 4.37",
"product": "SQUARE_POS"
},
"state": "IN_STOCK"
},
"errors": []
}
GET
RetrieveInventoryAdjustment
{{baseUrl}}/v2/inventory/adjustments/:adjustment_id
QUERY PARAMS
adjustment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id")
require "http/client"
url = "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/adjustments/:adjustment_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/adjustments/:adjustment_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/inventory/adjustments/:adjustment_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/adjustments/:adjustment_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/adjustments/:adjustment_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/inventory/adjustments/:adjustment_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/adjustments/:adjustment_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/adjustments/:adjustment_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/adjustments/:adjustment_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/adjustments/:adjustment_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/adjustments/:adjustment_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/inventory/adjustments/:adjustment_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/adjustments/:adjustment_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/inventory/adjustments/:adjustment_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/adjustments/:adjustment_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/inventory/adjustments/:adjustment_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/inventory/adjustments/:adjustment_id
http GET {{baseUrl}}/v2/inventory/adjustments/:adjustment_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/inventory/adjustments/:adjustment_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/adjustments/:adjustment_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"adjustment": {
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"created_at": "2016-11-17T13:02:15.142Z",
"employee_id": "LRK57NSQ5X7PUD05",
"from_state": "IN_STOCK",
"id": "UDMOEO78BG6GYWA2XDRYX3KB",
"location_id": "C6W5YS5QM06F5",
"occurred_at": "2016-11-16T25:44:22.837Z",
"quantity": "7",
"reference_id": "4a366069-4096-47a2-99a5-0084ac879509",
"source": {
"application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0",
"name": "Square Point of Sale 4.37",
"product": "SQUARE_POS"
},
"to_state": "SOLD",
"total_price_money": {
"amount": 4550,
"currency": "USD"
}
},
"errors": []
}
GET
RetrieveInventoryChanges
{{baseUrl}}/v2/inventory/:catalog_object_id/changes
QUERY PARAMS
catalog_object_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/:catalog_object_id/changes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/inventory/:catalog_object_id/changes")
require "http/client"
url = "{{baseUrl}}/v2/inventory/:catalog_object_id/changes"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/:catalog_object_id/changes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/:catalog_object_id/changes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/:catalog_object_id/changes"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/inventory/:catalog_object_id/changes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/inventory/:catalog_object_id/changes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/:catalog_object_id/changes"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/:catalog_object_id/changes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/inventory/:catalog_object_id/changes")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/inventory/:catalog_object_id/changes');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/:catalog_object_id/changes'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/:catalog_object_id/changes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/:catalog_object_id/changes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/:catalog_object_id/changes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/:catalog_object_id/changes',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/:catalog_object_id/changes'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/inventory/:catalog_object_id/changes');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/:catalog_object_id/changes'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/:catalog_object_id/changes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/:catalog_object_id/changes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/:catalog_object_id/changes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/:catalog_object_id/changes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/inventory/:catalog_object_id/changes');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/:catalog_object_id/changes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/inventory/:catalog_object_id/changes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/:catalog_object_id/changes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/:catalog_object_id/changes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/inventory/:catalog_object_id/changes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/:catalog_object_id/changes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/:catalog_object_id/changes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/:catalog_object_id/changes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/inventory/:catalog_object_id/changes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/:catalog_object_id/changes";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/inventory/:catalog_object_id/changes
http GET {{baseUrl}}/v2/inventory/:catalog_object_id/changes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/inventory/:catalog_object_id/changes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/:catalog_object_id/changes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"changes": [
{
"adjustment": {
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"created_at": "2016-11-16T22:25:24.878Z",
"employee_id": "AV7YRCGI2H1J5NQ8E1XIZCNA",
"from_state": "IN_STOCK",
"id": "OJKJIUANKLMLQANZADNPLKAD",
"location_id": "C6W5YS5QM06F5",
"occurred_at": "2016-11-16T22:25:24.878Z",
"quantity": "3",
"reference_id": "d8207693-168f-4b44-a2fd-a7ff533ddd26",
"source": {
"application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0",
"name": "Square Point of Sale 4.37",
"product": "SQUARE_POS"
},
"to_state": "SOLD",
"total_price_money": {
"amount": 5000,
"currency": "USD"
},
"transaction_id": "5APV6JYK1SNCZD11AND2RX1Z"
},
"type": "ADJUSTMENT"
}
],
"errors": []
}
GET
RetrieveInventoryCount
{{baseUrl}}/v2/inventory/:catalog_object_id
QUERY PARAMS
catalog_object_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/:catalog_object_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/inventory/:catalog_object_id")
require "http/client"
url = "{{baseUrl}}/v2/inventory/:catalog_object_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/:catalog_object_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/:catalog_object_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/:catalog_object_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/inventory/:catalog_object_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/inventory/:catalog_object_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/:catalog_object_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/:catalog_object_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/inventory/:catalog_object_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/inventory/:catalog_object_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/:catalog_object_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/:catalog_object_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/:catalog_object_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/:catalog_object_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/:catalog_object_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/:catalog_object_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/inventory/:catalog_object_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/:catalog_object_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/:catalog_object_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/:catalog_object_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/:catalog_object_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/:catalog_object_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/inventory/:catalog_object_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/:catalog_object_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/inventory/:catalog_object_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/:catalog_object_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/:catalog_object_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/inventory/:catalog_object_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/:catalog_object_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/:catalog_object_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/:catalog_object_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/inventory/:catalog_object_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/:catalog_object_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/inventory/:catalog_object_id
http GET {{baseUrl}}/v2/inventory/:catalog_object_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/inventory/:catalog_object_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/:catalog_object_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"counts": [
{
"calculated_at": "2016-11-16T22:28:01.223Z",
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"location_id": "C6W5YS5QM06F5",
"quantity": "22",
"state": "IN_STOCK"
}
],
"errors": []
}
GET
RetrieveInventoryPhysicalCount
{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id
QUERY PARAMS
physical_count_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id")
require "http/client"
url = "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/inventory/physical-counts/:physical_count_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/physical-counts/:physical_count_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/inventory/physical-counts/:physical_count_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/inventory/physical-counts/:physical_count_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/inventory/physical-counts/:physical_count_id
http GET {{baseUrl}}/v2/inventory/physical-counts/:physical_count_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/inventory/physical-counts/:physical_count_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/physical-counts/:physical_count_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"count": {
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"created_at": "2016-11-16T22:25:24.878Z",
"employee_id": "LRK57NSQ5X7PUD05",
"id": "ANZADNPLKADOJKJIUANKLMLQ",
"location_id": "C6W5YS5QM06F5",
"occurred_at": "2016-11-16T22:25:24.878Z",
"quantity": "15",
"reference_id": "f857ec37-f9a0-4458-8e23-5b5e0bea4e53",
"source": {
"application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0",
"name": "Square Point of Sale 4.37",
"product": "SQUARE_POS"
},
"state": "IN_STOCK"
},
"errors": []
}
GET
RetrieveInventoryTransfer
{{baseUrl}}/v2/inventory/transfers/:transfer_id
QUERY PARAMS
transfer_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/inventory/transfers/:transfer_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/inventory/transfers/:transfer_id")
require "http/client"
url = "{{baseUrl}}/v2/inventory/transfers/:transfer_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/inventory/transfers/:transfer_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/inventory/transfers/:transfer_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/inventory/transfers/:transfer_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/inventory/transfers/:transfer_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/inventory/transfers/:transfer_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/inventory/transfers/:transfer_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/inventory/transfers/:transfer_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/inventory/transfers/:transfer_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/inventory/transfers/:transfer_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/transfers/:transfer_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/inventory/transfers/:transfer_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/inventory/transfers/:transfer_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/inventory/transfers/:transfer_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/inventory/transfers/:transfer_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/transfers/:transfer_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/inventory/transfers/:transfer_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/inventory/transfers/:transfer_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/inventory/transfers/:transfer_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/inventory/transfers/:transfer_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/inventory/transfers/:transfer_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/inventory/transfers/:transfer_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/inventory/transfers/:transfer_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/inventory/transfers/:transfer_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/inventory/transfers/:transfer_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/inventory/transfers/:transfer_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/inventory/transfers/:transfer_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/inventory/transfers/:transfer_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/inventory/transfers/:transfer_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/inventory/transfers/:transfer_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/inventory/transfers/:transfer_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/inventory/transfers/:transfer_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/inventory/transfers/:transfer_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/inventory/transfers/:transfer_id
http GET {{baseUrl}}/v2/inventory/transfers/:transfer_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/inventory/transfers/:transfer_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/inventory/transfers/:transfer_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [],
"transfer": {
"catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
"catalog_object_type": "ITEM_VARIATION",
"created_at": "2016-11-17T13:02:15.142Z",
"employee_id": "LRK57NSQ5X7PUD05",
"from_location_id": "C6W5YS5QM06F5",
"id": "UDMOEO78BG6GYWA2XDRYX3KB",
"occurred_at": "2016-11-16T25:44:22.837Z",
"quantity": "7",
"reference_id": "4a366069-4096-47a2-99a5-0084ac879509",
"source": {
"application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0",
"name": "Square Point of Sale 4.37",
"product": "SQUARE_POS"
},
"state": "IN_STOCK",
"to_location_id": "59TNP9SA8VGDA"
}
}
POST
CancelInvoice
{{baseUrl}}/v2/invoices/:invoice_id/cancel
QUERY PARAMS
invoice_id
BODY json
{
"version": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/invoices/:invoice_id/cancel");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"version\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/invoices/:invoice_id/cancel" {:content-type :json
:form-params {:version 0}})
require "http/client"
url = "{{baseUrl}}/v2/invoices/:invoice_id/cancel"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"version\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/invoices/:invoice_id/cancel"),
Content = new StringContent("{\n \"version\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/invoices/:invoice_id/cancel");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"version\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/invoices/:invoice_id/cancel"
payload := strings.NewReader("{\n \"version\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/invoices/:invoice_id/cancel HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 18
{
"version": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/invoices/:invoice_id/cancel")
.setHeader("content-type", "application/json")
.setBody("{\n \"version\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/invoices/:invoice_id/cancel"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"version\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"version\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id/cancel")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/invoices/:invoice_id/cancel")
.header("content-type", "application/json")
.body("{\n \"version\": 0\n}")
.asString();
const data = JSON.stringify({
version: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/invoices/:invoice_id/cancel');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/:invoice_id/cancel',
headers: {'content-type': 'application/json'},
data: {version: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/invoices/:invoice_id/cancel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"version":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/invoices/:invoice_id/cancel',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "version": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"version\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id/cancel")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/invoices/:invoice_id/cancel',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({version: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/:invoice_id/cancel',
headers: {'content-type': 'application/json'},
body: {version: 0},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/invoices/:invoice_id/cancel');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
version: 0
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/:invoice_id/cancel',
headers: {'content-type': 'application/json'},
data: {version: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/invoices/:invoice_id/cancel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"version":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"version": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/invoices/:invoice_id/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/invoices/:invoice_id/cancel" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"version\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/invoices/:invoice_id/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'version' => 0
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/invoices/:invoice_id/cancel', [
'body' => '{
"version": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/invoices/:invoice_id/cancel');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'version' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'version' => 0
]));
$request->setRequestUrl('{{baseUrl}}/v2/invoices/:invoice_id/cancel');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/invoices/:invoice_id/cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"version": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/invoices/:invoice_id/cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"version": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"version\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/invoices/:invoice_id/cancel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/invoices/:invoice_id/cancel"
payload = { "version": 0 }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/invoices/:invoice_id/cancel"
payload <- "{\n \"version\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/invoices/:invoice_id/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"version\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/invoices/:invoice_id/cancel') do |req|
req.body = "{\n \"version\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/invoices/:invoice_id/cancel";
let payload = json!({"version": 0});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/invoices/:invoice_id/cancel \
--header 'content-type: application/json' \
--data '{
"version": 0
}'
echo '{
"version": 0
}' | \
http POST {{baseUrl}}/v2/invoices/:invoice_id/cancel \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "version": 0\n}' \
--output-document \
- {{baseUrl}}/v2/invoices/:invoice_id/cancel
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["version": 0] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/invoices/:invoice_id/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": false
},
"created_at": "2020-06-18T17:45:13Z",
"custom_fields": [
{
"label": "Event Reference Number",
"placement": "ABOVE_LINE_ITEMS",
"value": "Ref. #1234"
},
{
"label": "Terms of Service",
"placement": "BELOW_LINE_ITEMS",
"value": "The terms of service are..."
}
],
"delivery_method": "EMAIL",
"description": "We appreciate your business!",
"id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
"invoice_number": "inv-100",
"location_id": "ES0RJRZYEC39A",
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"payment_requests": [
{
"automatic_payment_source": "NONE",
"computed_amount_money": {
"amount": 10000,
"currency": "USD"
},
"due_date": "2030-01-24",
"reminders": [
{
"message": "Your invoice is due tomorrow",
"relative_scheduled_days": -1,
"status": "PENDING",
"uid": "beebd363-e47f-4075-8785-c235aaa7df11"
}
],
"request_type": "BALANCE",
"tipping_enabled": true,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"scheduled_at": "2030-01-13T10:00:00Z",
"status": "CANCELED",
"timezone": "America/Los_Angeles",
"title": "Event Planning Services",
"updated_at": "2020-06-18T18:23:11Z",
"version": 1
}
}
POST
CreateInvoice
{{baseUrl}}/v2/invoices
BODY json
{
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/invoices");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/invoices" {:content-type :json
:form-params {:idempotency_key ""
:invoice {:accepted_payment_methods {:bank_account false
:card false
:square_gift_card false}
:created_at ""
:custom_fields [{:label ""
:placement ""
:value ""}]
:delivery_method ""
:description ""
:id ""
:invoice_number ""
:location_id ""
:next_payment_amount_money {:amount 0
:currency ""}
:order_id ""
:payment_requests [{:automatic_payment_source ""
:card_id ""
:computed_amount_money {}
:due_date ""
:fixed_amount_requested_money {}
:percentage_requested ""
:reminders [{:message ""
:relative_scheduled_days 0
:sent_at ""
:status ""
:uid ""}]
:request_method ""
:request_type ""
:rounding_adjustment_included_money {}
:tipping_enabled false
:total_completed_amount_money {}
:uid ""}]
:primary_recipient {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:company_name ""
:customer_id ""
:email_address ""
:family_name ""
:given_name ""
:phone_number ""}
:public_url ""
:scheduled_at ""
:status ""
:subscription_id ""
:timezone ""
:title ""
:updated_at ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/invoices"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/invoices"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/invoices");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/invoices"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/invoices HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2027
{
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/invoices")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/invoices"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/invoices")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/invoices")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
invoice: {
accepted_payment_methods: {
bank_account: false,
card: false,
square_gift_card: false
},
created_at: '',
custom_fields: [
{
label: '',
placement: '',
value: ''
}
],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {
amount: 0,
currency: ''
},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [
{
message: '',
relative_scheduled_days: 0,
sent_at: '',
status: '',
uid: ''
}
],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/invoices');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
invoice: {
accepted_payment_methods: {bank_account: false, card: false, square_gift_card: false},
created_at: '',
custom_fields: [{label: '', placement: '', value: ''}],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {amount: 0, currency: ''},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [{message: '', relative_scheduled_days: 0, sent_at: '', status: '', uid: ''}],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/invoices';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","invoice":{"accepted_payment_methods":{"bank_account":false,"card":false,"square_gift_card":false},"created_at":"","custom_fields":[{"label":"","placement":"","value":""}],"delivery_method":"","description":"","id":"","invoice_number":"","location_id":"","next_payment_amount_money":{"amount":0,"currency":""},"order_id":"","payment_requests":[{"automatic_payment_source":"","card_id":"","computed_amount_money":{},"due_date":"","fixed_amount_requested_money":{},"percentage_requested":"","reminders":[{"message":"","relative_scheduled_days":0,"sent_at":"","status":"","uid":""}],"request_method":"","request_type":"","rounding_adjustment_included_money":{},"tipping_enabled":false,"total_completed_amount_money":{},"uid":""}],"primary_recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"company_name":"","customer_id":"","email_address":"","family_name":"","given_name":"","phone_number":""},"public_url":"","scheduled_at":"","status":"","subscription_id":"","timezone":"","title":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/invoices',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "invoice": {\n "accepted_payment_methods": {\n "bank_account": false,\n "card": false,\n "square_gift_card": false\n },\n "created_at": "",\n "custom_fields": [\n {\n "label": "",\n "placement": "",\n "value": ""\n }\n ],\n "delivery_method": "",\n "description": "",\n "id": "",\n "invoice_number": "",\n "location_id": "",\n "next_payment_amount_money": {\n "amount": 0,\n "currency": ""\n },\n "order_id": "",\n "payment_requests": [\n {\n "automatic_payment_source": "",\n "card_id": "",\n "computed_amount_money": {},\n "due_date": "",\n "fixed_amount_requested_money": {},\n "percentage_requested": "",\n "reminders": [\n {\n "message": "",\n "relative_scheduled_days": 0,\n "sent_at": "",\n "status": "",\n "uid": ""\n }\n ],\n "request_method": "",\n "request_type": "",\n "rounding_adjustment_included_money": {},\n "tipping_enabled": false,\n "total_completed_amount_money": {},\n "uid": ""\n }\n ],\n "primary_recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "company_name": "",\n "customer_id": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "phone_number": ""\n },\n "public_url": "",\n "scheduled_at": "",\n "status": "",\n "subscription_id": "",\n "timezone": "",\n "title": "",\n "updated_at": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/invoices")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/invoices',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
invoice: {
accepted_payment_methods: {bank_account: false, card: false, square_gift_card: false},
created_at: '',
custom_fields: [{label: '', placement: '', value: ''}],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {amount: 0, currency: ''},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [{message: '', relative_scheduled_days: 0, sent_at: '', status: '', uid: ''}],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
invoice: {
accepted_payment_methods: {bank_account: false, card: false, square_gift_card: false},
created_at: '',
custom_fields: [{label: '', placement: '', value: ''}],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {amount: 0, currency: ''},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [{message: '', relative_scheduled_days: 0, sent_at: '', status: '', uid: ''}],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/invoices');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
invoice: {
accepted_payment_methods: {
bank_account: false,
card: false,
square_gift_card: false
},
created_at: '',
custom_fields: [
{
label: '',
placement: '',
value: ''
}
],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {
amount: 0,
currency: ''
},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [
{
message: '',
relative_scheduled_days: 0,
sent_at: '',
status: '',
uid: ''
}
],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
invoice: {
accepted_payment_methods: {bank_account: false, card: false, square_gift_card: false},
created_at: '',
custom_fields: [{label: '', placement: '', value: ''}],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {amount: 0, currency: ''},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [{message: '', relative_scheduled_days: 0, sent_at: '', status: '', uid: ''}],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/invoices';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","invoice":{"accepted_payment_methods":{"bank_account":false,"card":false,"square_gift_card":false},"created_at":"","custom_fields":[{"label":"","placement":"","value":""}],"delivery_method":"","description":"","id":"","invoice_number":"","location_id":"","next_payment_amount_money":{"amount":0,"currency":""},"order_id":"","payment_requests":[{"automatic_payment_source":"","card_id":"","computed_amount_money":{},"due_date":"","fixed_amount_requested_money":{},"percentage_requested":"","reminders":[{"message":"","relative_scheduled_days":0,"sent_at":"","status":"","uid":""}],"request_method":"","request_type":"","rounding_adjustment_included_money":{},"tipping_enabled":false,"total_completed_amount_money":{},"uid":""}],"primary_recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"company_name":"","customer_id":"","email_address":"","family_name":"","given_name":"","phone_number":""},"public_url":"","scheduled_at":"","status":"","subscription_id":"","timezone":"","title":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"invoice": @{ @"accepted_payment_methods": @{ @"bank_account": @NO, @"card": @NO, @"square_gift_card": @NO }, @"created_at": @"", @"custom_fields": @[ @{ @"label": @"", @"placement": @"", @"value": @"" } ], @"delivery_method": @"", @"description": @"", @"id": @"", @"invoice_number": @"", @"location_id": @"", @"next_payment_amount_money": @{ @"amount": @0, @"currency": @"" }, @"order_id": @"", @"payment_requests": @[ @{ @"automatic_payment_source": @"", @"card_id": @"", @"computed_amount_money": @{ }, @"due_date": @"", @"fixed_amount_requested_money": @{ }, @"percentage_requested": @"", @"reminders": @[ @{ @"message": @"", @"relative_scheduled_days": @0, @"sent_at": @"", @"status": @"", @"uid": @"" } ], @"request_method": @"", @"request_type": @"", @"rounding_adjustment_included_money": @{ }, @"tipping_enabled": @NO, @"total_completed_amount_money": @{ }, @"uid": @"" } ], @"primary_recipient": @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"company_name": @"", @"customer_id": @"", @"email_address": @"", @"family_name": @"", @"given_name": @"", @"phone_number": @"" }, @"public_url": @"", @"scheduled_at": @"", @"status": @"", @"subscription_id": @"", @"timezone": @"", @"title": @"", @"updated_at": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/invoices"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/invoices" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'invoice' => [
'accepted_payment_methods' => [
'bank_account' => null,
'card' => null,
'square_gift_card' => null
],
'created_at' => '',
'custom_fields' => [
[
'label' => '',
'placement' => '',
'value' => ''
]
],
'delivery_method' => '',
'description' => '',
'id' => '',
'invoice_number' => '',
'location_id' => '',
'next_payment_amount_money' => [
'amount' => 0,
'currency' => ''
],
'order_id' => '',
'payment_requests' => [
[
'automatic_payment_source' => '',
'card_id' => '',
'computed_amount_money' => [
],
'due_date' => '',
'fixed_amount_requested_money' => [
],
'percentage_requested' => '',
'reminders' => [
[
'message' => '',
'relative_scheduled_days' => 0,
'sent_at' => '',
'status' => '',
'uid' => ''
]
],
'request_method' => '',
'request_type' => '',
'rounding_adjustment_included_money' => [
],
'tipping_enabled' => null,
'total_completed_amount_money' => [
],
'uid' => ''
]
],
'primary_recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'company_name' => '',
'customer_id' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'phone_number' => ''
],
'public_url' => '',
'scheduled_at' => '',
'status' => '',
'subscription_id' => '',
'timezone' => '',
'title' => '',
'updated_at' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/invoices', [
'body' => '{
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/invoices');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'invoice' => [
'accepted_payment_methods' => [
'bank_account' => null,
'card' => null,
'square_gift_card' => null
],
'created_at' => '',
'custom_fields' => [
[
'label' => '',
'placement' => '',
'value' => ''
]
],
'delivery_method' => '',
'description' => '',
'id' => '',
'invoice_number' => '',
'location_id' => '',
'next_payment_amount_money' => [
'amount' => 0,
'currency' => ''
],
'order_id' => '',
'payment_requests' => [
[
'automatic_payment_source' => '',
'card_id' => '',
'computed_amount_money' => [
],
'due_date' => '',
'fixed_amount_requested_money' => [
],
'percentage_requested' => '',
'reminders' => [
[
'message' => '',
'relative_scheduled_days' => 0,
'sent_at' => '',
'status' => '',
'uid' => ''
]
],
'request_method' => '',
'request_type' => '',
'rounding_adjustment_included_money' => [
],
'tipping_enabled' => null,
'total_completed_amount_money' => [
],
'uid' => ''
]
],
'primary_recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'company_name' => '',
'customer_id' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'phone_number' => ''
],
'public_url' => '',
'scheduled_at' => '',
'status' => '',
'subscription_id' => '',
'timezone' => '',
'title' => '',
'updated_at' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'invoice' => [
'accepted_payment_methods' => [
'bank_account' => null,
'card' => null,
'square_gift_card' => null
],
'created_at' => '',
'custom_fields' => [
[
'label' => '',
'placement' => '',
'value' => ''
]
],
'delivery_method' => '',
'description' => '',
'id' => '',
'invoice_number' => '',
'location_id' => '',
'next_payment_amount_money' => [
'amount' => 0,
'currency' => ''
],
'order_id' => '',
'payment_requests' => [
[
'automatic_payment_source' => '',
'card_id' => '',
'computed_amount_money' => [
],
'due_date' => '',
'fixed_amount_requested_money' => [
],
'percentage_requested' => '',
'reminders' => [
[
'message' => '',
'relative_scheduled_days' => 0,
'sent_at' => '',
'status' => '',
'uid' => ''
]
],
'request_method' => '',
'request_type' => '',
'rounding_adjustment_included_money' => [
],
'tipping_enabled' => null,
'total_completed_amount_money' => [
],
'uid' => ''
]
],
'primary_recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'company_name' => '',
'customer_id' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'phone_number' => ''
],
'public_url' => '',
'scheduled_at' => '',
'status' => '',
'subscription_id' => '',
'timezone' => '',
'title' => '',
'updated_at' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/invoices');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/invoices' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/invoices' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/invoices", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/invoices"
payload = {
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": False,
"card": False,
"square_gift_card": False
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": False,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/invoices"
payload <- "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/invoices') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/invoices";
let payload = json!({
"idempotency_key": "",
"invoice": json!({
"accepted_payment_methods": json!({
"bank_account": false,
"card": false,
"square_gift_card": false
}),
"created_at": "",
"custom_fields": (
json!({
"label": "",
"placement": "",
"value": ""
})
),
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": json!({
"amount": 0,
"currency": ""
}),
"order_id": "",
"payment_requests": (
json!({
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": json!({}),
"due_date": "",
"fixed_amount_requested_money": json!({}),
"percentage_requested": "",
"reminders": (
json!({
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
})
),
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": json!({}),
"tipping_enabled": false,
"total_completed_amount_money": json!({}),
"uid": ""
})
),
"primary_recipient": json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
}),
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/invoices \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}'
echo '{
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}' | \
http POST {{baseUrl}}/v2/invoices \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "invoice": {\n "accepted_payment_methods": {\n "bank_account": false,\n "card": false,\n "square_gift_card": false\n },\n "created_at": "",\n "custom_fields": [\n {\n "label": "",\n "placement": "",\n "value": ""\n }\n ],\n "delivery_method": "",\n "description": "",\n "id": "",\n "invoice_number": "",\n "location_id": "",\n "next_payment_amount_money": {\n "amount": 0,\n "currency": ""\n },\n "order_id": "",\n "payment_requests": [\n {\n "automatic_payment_source": "",\n "card_id": "",\n "computed_amount_money": {},\n "due_date": "",\n "fixed_amount_requested_money": {},\n "percentage_requested": "",\n "reminders": [\n {\n "message": "",\n "relative_scheduled_days": 0,\n "sent_at": "",\n "status": "",\n "uid": ""\n }\n ],\n "request_method": "",\n "request_type": "",\n "rounding_adjustment_included_money": {},\n "tipping_enabled": false,\n "total_completed_amount_money": {},\n "uid": ""\n }\n ],\n "primary_recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "company_name": "",\n "customer_id": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "phone_number": ""\n },\n "public_url": "",\n "scheduled_at": "",\n "status": "",\n "subscription_id": "",\n "timezone": "",\n "title": "",\n "updated_at": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/invoices
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"invoice": [
"accepted_payment_methods": [
"bank_account": false,
"card": false,
"square_gift_card": false
],
"created_at": "",
"custom_fields": [
[
"label": "",
"placement": "",
"value": ""
]
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": [
"amount": 0,
"currency": ""
],
"order_id": "",
"payment_requests": [
[
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": [],
"due_date": "",
"fixed_amount_requested_money": [],
"percentage_requested": "",
"reminders": [
[
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
]
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": [],
"tipping_enabled": false,
"total_completed_amount_money": [],
"uid": ""
]
],
"primary_recipient": [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
],
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/invoices")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": false
},
"created_at": "2020-06-18T17:45:13Z",
"custom_fields": [
{
"label": "Event Reference Number",
"placement": "ABOVE_LINE_ITEMS",
"value": "Ref. #1234"
},
{
"label": "Terms of Service",
"placement": "BELOW_LINE_ITEMS",
"value": "The terms of service are..."
}
],
"delivery_method": "EMAIL",
"description": "We appreciate your business!",
"id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
"invoice_number": "inv-100",
"location_id": "ES0RJRZYEC39A",
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"payment_requests": [
{
"automatic_payment_source": "NONE",
"computed_amount_money": {
"amount": 10000,
"currency": "USD"
},
"due_date": "2030-01-24",
"reminders": [
{
"message": "Your invoice is due tomorrow",
"relative_scheduled_days": -1,
"status": "PENDING",
"uid": "beebd363-e47f-4075-8785-c235aaa7df11"
}
],
"request_type": "BALANCE",
"tipping_enabled": true,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"scheduled_at": "2030-01-13T10:00:00Z",
"status": "DRAFT",
"timezone": "America/Los_Angeles",
"title": "Event Planning Services",
"updated_at": "2020-06-18T17:45:13Z",
"version": 0
}
}
DELETE
DeleteInvoice
{{baseUrl}}/v2/invoices/:invoice_id
QUERY PARAMS
invoice_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/invoices/:invoice_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/invoices/:invoice_id")
require "http/client"
url = "{{baseUrl}}/v2/invoices/:invoice_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/invoices/:invoice_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/invoices/:invoice_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/invoices/:invoice_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/invoices/:invoice_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/invoices/:invoice_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/invoices/:invoice_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/invoices/:invoice_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/invoices/:invoice_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/invoices/:invoice_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/invoices/:invoice_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/invoices/:invoice_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/invoices/:invoice_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/invoices/:invoice_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/invoices/:invoice_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/invoices/:invoice_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/invoices/:invoice_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/invoices/:invoice_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/invoices/:invoice_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/invoices/:invoice_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/invoices/:invoice_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/invoices/:invoice_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/invoices/:invoice_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/invoices/:invoice_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/invoices/:invoice_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/invoices/:invoice_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/invoices/:invoice_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/invoices/:invoice_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/invoices/:invoice_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/invoices/:invoice_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/invoices/:invoice_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/invoices/:invoice_id
http DELETE {{baseUrl}}/v2/invoices/:invoice_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/invoices/:invoice_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/invoices/:invoice_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
GET
GetInvoice
{{baseUrl}}/v2/invoices/:invoice_id
QUERY PARAMS
invoice_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/invoices/:invoice_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/invoices/:invoice_id")
require "http/client"
url = "{{baseUrl}}/v2/invoices/:invoice_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/invoices/:invoice_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/invoices/:invoice_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/invoices/:invoice_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/invoices/:invoice_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/invoices/:invoice_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/invoices/:invoice_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/invoices/:invoice_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/invoices/:invoice_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/invoices/:invoice_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/invoices/:invoice_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/invoices/:invoice_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/invoices/:invoice_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/invoices/:invoice_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/invoices/:invoice_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/invoices/:invoice_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/invoices/:invoice_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/invoices/:invoice_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/invoices/:invoice_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/invoices/:invoice_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/invoices/:invoice_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/invoices/:invoice_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/invoices/:invoice_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/invoices/:invoice_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/invoices/:invoice_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/invoices/:invoice_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/invoices/:invoice_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/invoices/:invoice_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/invoices/:invoice_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/invoices/:invoice_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/invoices/:invoice_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/invoices/:invoice_id
http GET {{baseUrl}}/v2/invoices/:invoice_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/invoices/:invoice_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/invoices/:invoice_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": false
},
"created_at": "2020-06-18T17:45:13Z",
"custom_fields": [
{
"label": "Event Reference Number",
"placement": "ABOVE_LINE_ITEMS",
"value": "Ref. #1234"
},
{
"label": "Terms of Service",
"placement": "BELOW_LINE_ITEMS",
"value": "The terms of service are..."
}
],
"delivery_method": "EMAIL",
"description": "We appreciate your business!",
"id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
"invoice_number": "inv-100",
"location_id": "ES0RJRZYEC39A",
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"payment_requests": [
{
"automatic_payment_source": "NONE",
"computed_amount_money": {
"amount": 10000,
"currency": "USD"
},
"due_date": "2030-01-24",
"reminders": [
{
"message": "Your invoice is due tomorrow",
"relative_scheduled_days": -1,
"status": "PENDING",
"uid": "beebd363-e47f-4075-8785-c235aaa7df11"
}
],
"request_type": "BALANCE",
"tipping_enabled": true,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"scheduled_at": "2030-01-13T10:00:00Z",
"status": "DRAFT",
"timezone": "America/Los_Angeles",
"title": "Event Planning Services",
"updated_at": "2020-06-18T17:45:13Z",
"version": 0
}
}
GET
ListInvoices
{{baseUrl}}/v2/invoices
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/invoices?location_id=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/invoices" {:query-params {:location_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/invoices?location_id="
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/invoices?location_id="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/invoices?location_id=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/invoices?location_id="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/invoices?location_id= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/invoices?location_id=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/invoices?location_id="))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/invoices?location_id=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/invoices?location_id=")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/invoices?location_id=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/invoices',
params: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/invoices?location_id=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/invoices?location_id=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/invoices?location_id=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/invoices?location_id=',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/invoices',
qs: {location_id: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/invoices');
req.query({
location_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/invoices',
params: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/invoices?location_id=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/invoices?location_id="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/invoices?location_id=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/invoices?location_id=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/invoices?location_id=');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/invoices');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'location_id' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/invoices');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'location_id' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/invoices?location_id=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/invoices?location_id=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/invoices?location_id=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/invoices"
querystring = {"location_id":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/invoices"
queryString <- list(location_id = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/invoices?location_id=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/invoices') do |req|
req.params['location_id'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/invoices";
let querystring = [
("location_id", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/v2/invoices?location_id='
http GET '{{baseUrl}}/v2/invoices?location_id='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/v2/invoices?location_id='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/invoices?location_id=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "ChoIDhIWVm54ZVRhLXhySFBOejBBM2xJb2daUQoFCI4IGAE",
"invoices": [
{
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": false
},
"created_at": "2020-06-18T17:45:13Z",
"custom_fields": [
{
"label": "Event Reference Number",
"placement": "ABOVE_LINE_ITEMS",
"value": "Ref. #1234"
},
{
"label": "Terms of Service",
"placement": "BELOW_LINE_ITEMS",
"value": "The terms of service are..."
}
],
"delivery_method": "EMAIL",
"description": "We appreciate your business!",
"id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
"invoice_number": "inv-100",
"location_id": "ES0RJRZYEC39A",
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"payment_requests": [
{
"automatic_payment_source": "NONE",
"computed_amount_money": {
"amount": 10000,
"currency": "USD"
},
"due_date": "2030-01-24",
"reminders": [
{
"message": "Your invoice is due tomorrow",
"relative_scheduled_days": -1,
"status": "PENDING",
"uid": "beebd363-e47f-4075-8785-c235aaa7df11"
}
],
"request_type": "BALANCE",
"tipping_enabled": true,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"scheduled_at": "2030-01-13T10:00:00Z",
"status": "DRAFT",
"timezone": "America/Los_Angeles",
"title": "Event Planning Services",
"updated_at": "2020-06-18T17:45:13Z",
"version": 0
},
{
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": true
},
"created_at": "2021-01-23T15:29:12Z",
"delivery_method": "EMAIL",
"id": "inv:0-ChC366qAfskpGrBI_1bozs9mEA3",
"invoice_number": "inv-455",
"location_id": "ES0RJRZYEC39A",
"next_payment_amount_money": {
"amount": 3000,
"currency": "USD"
},
"order_id": "a65jnS8NXbfprvGJzY9F4fQTuaB",
"payment_requests": [
{
"automatic_payment_source": "CARD_ON_FILE",
"card_id": "ccof:IkWfpLj4tNHMyFii3GB",
"computed_amount_money": {
"amount": 1000,
"currency": "USD"
},
"due_date": "2021-01-23",
"percentage_requested": "25",
"request_type": "DEPOSIT",
"tipping_enabled": false,
"total_completed_amount_money": {
"amount": 1000,
"currency": "USD"
},
"uid": "66c3bdfd-5090-4ff9-a8a0-c1e1a2ffa176"
},
{
"automatic_payment_source": "CARD_ON_FILE",
"card_id": "ccof:IkWfpLj4tNHMyFii3GB",
"computed_amount_money": {
"amount": 3000,
"currency": "USD"
},
"due_date": "2021-06-15",
"request_type": "BALANCE",
"tipping_enabled": false,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "120c5e18-4f80-4f6b-b159-774cb9bf8f99"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"public_url": "https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ",
"status": "PARTIALLY_PAID",
"timezone": "America/Los_Angeles",
"updated_at": "2021-01-23T15:29:56Z",
"version": 3
}
]
}
POST
PublishInvoice
{{baseUrl}}/v2/invoices/:invoice_id/publish
QUERY PARAMS
invoice_id
BODY json
{
"idempotency_key": "",
"version": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/invoices/:invoice_id/publish");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/invoices/:invoice_id/publish" {:content-type :json
:form-params {:idempotency_key ""
:version 0}})
require "http/client"
url = "{{baseUrl}}/v2/invoices/:invoice_id/publish"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/invoices/:invoice_id/publish"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"version\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/invoices/:invoice_id/publish");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/invoices/:invoice_id/publish"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"version\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/invoices/:invoice_id/publish HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 43
{
"idempotency_key": "",
"version": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/invoices/:invoice_id/publish")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"version\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/invoices/:invoice_id/publish"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"version\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id/publish")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/invoices/:invoice_id/publish")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"version\": 0\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
version: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/invoices/:invoice_id/publish');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/:invoice_id/publish',
headers: {'content-type': 'application/json'},
data: {idempotency_key: '', version: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/invoices/:invoice_id/publish';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","version":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/invoices/:invoice_id/publish',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "version": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id/publish")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/invoices/:invoice_id/publish',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({idempotency_key: '', version: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/:invoice_id/publish',
headers: {'content-type': 'application/json'},
body: {idempotency_key: '', version: 0},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/invoices/:invoice_id/publish');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
version: 0
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/:invoice_id/publish',
headers: {'content-type': 'application/json'},
data: {idempotency_key: '', version: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/invoices/:invoice_id/publish';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","version":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"version": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/invoices/:invoice_id/publish"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/invoices/:invoice_id/publish" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/invoices/:invoice_id/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'version' => 0
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/invoices/:invoice_id/publish', [
'body' => '{
"idempotency_key": "",
"version": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/invoices/:invoice_id/publish');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'version' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'version' => 0
]));
$request->setRequestUrl('{{baseUrl}}/v2/invoices/:invoice_id/publish');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/invoices/:invoice_id/publish' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"version": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/invoices/:invoice_id/publish' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"version": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/invoices/:invoice_id/publish", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/invoices/:invoice_id/publish"
payload = {
"idempotency_key": "",
"version": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/invoices/:invoice_id/publish"
payload <- "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/invoices/:invoice_id/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/invoices/:invoice_id/publish') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"version\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/invoices/:invoice_id/publish";
let payload = json!({
"idempotency_key": "",
"version": 0
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/invoices/:invoice_id/publish \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"version": 0
}'
echo '{
"idempotency_key": "",
"version": 0
}' | \
http POST {{baseUrl}}/v2/invoices/:invoice_id/publish \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "version": 0\n}' \
--output-document \
- {{baseUrl}}/v2/invoices/:invoice_id/publish
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"version": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/invoices/:invoice_id/publish")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": false
},
"created_at": "2020-06-18T17:45:13Z",
"custom_fields": [
{
"label": "Event Reference Number",
"placement": "ABOVE_LINE_ITEMS",
"value": "Ref. #1234"
},
{
"label": "Terms of Service",
"placement": "BELOW_LINE_ITEMS",
"value": "The terms of service are..."
}
],
"delivery_method": "EMAIL",
"description": "We appreciate your business!",
"id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
"invoice_number": "inv-100",
"location_id": "ES0RJRZYEC39A",
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"payment_requests": [
{
"automatic_payment_source": "NONE",
"computed_amount_money": {
"amount": 10000,
"currency": "USD"
},
"due_date": "2030-01-24",
"reminders": [
{
"message": "Your invoice is due tomorrow",
"relative_scheduled_days": -1,
"status": "PENDING",
"uid": "beebd363-e47f-4075-8785-c235aaa7df11"
}
],
"request_type": "BALANCE",
"tipping_enabled": true,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"public_url": "https://squareup.com/pay-invoice/inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
"scheduled_at": "2030-01-13T10:00:00Z",
"status": "SCHEDULED",
"timezone": "America/Los_Angeles",
"title": "Event Planning Services",
"updated_at": "2020-06-18T18:23:11Z",
"version": 1
}
}
POST
SearchInvoices
{{baseUrl}}/v2/invoices/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
},
"sort": {
"field": "",
"order": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/invoices/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/invoices/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:filter {:customer_ids []
:location_ids []}
:sort {:field ""
:order ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/invoices/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/invoices/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/invoices/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/invoices/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/invoices/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 181
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
},
"sort": {
"field": "",
"order": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/invoices/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/invoices/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/invoices/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/invoices/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
customer_ids: [],
location_ids: []
},
sort: {
field: '',
order: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/invoices/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {filter: {customer_ids: [], location_ids: []}, sort: {field: '', order: ''}}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/invoices/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"customer_ids":[],"location_ids":[]},"sort":{"field":"","order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/invoices/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "customer_ids": [],\n "location_ids": []\n },\n "sort": {\n "field": "",\n "order": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/invoices/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/invoices/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cursor: '',
limit: 0,
query: {filter: {customer_ids: [], location_ids: []}, sort: {field: '', order: ''}}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/search',
headers: {'content-type': 'application/json'},
body: {
cursor: '',
limit: 0,
query: {filter: {customer_ids: [], location_ids: []}, sort: {field: '', order: ''}}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/invoices/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
filter: {
customer_ids: [],
location_ids: []
},
sort: {
field: '',
order: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/invoices/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {filter: {customer_ids: [], location_ids: []}, sort: {field: '', order: ''}}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/invoices/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"customer_ids":[],"location_ids":[]},"sort":{"field":"","order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"filter": @{ @"customer_ids": @[ ], @"location_ids": @[ ] }, @"sort": @{ @"field": @"", @"order": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/invoices/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/invoices/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/invoices/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'customer_ids' => [
],
'location_ids' => [
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/invoices/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
},
"sort": {
"field": "",
"order": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/invoices/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'customer_ids' => [
],
'location_ids' => [
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'customer_ids' => [
],
'location_ids' => [
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/invoices/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/invoices/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
},
"sort": {
"field": "",
"order": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/invoices/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
},
"sort": {
"field": "",
"order": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/invoices/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/invoices/search"
payload = {
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
},
"sort": {
"field": "",
"order": ""
}
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/invoices/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/invoices/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/invoices/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/invoices/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({
"filter": json!({
"customer_ids": (),
"location_ids": ()
}),
"sort": json!({
"field": "",
"order": ""
})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/invoices/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
},
"sort": {
"field": "",
"order": ""
}
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
},
"sort": {
"field": "",
"order": ""
}
}
}' | \
http POST {{baseUrl}}/v2/invoices/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "customer_ids": [],\n "location_ids": []\n },\n "sort": {\n "field": "",\n "order": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/invoices/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": [
"filter": [
"customer_ids": [],
"location_ids": []
],
"sort": [
"field": "",
"order": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/invoices/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "ChoIDhIWVm54ZVRhLXhySFBOejBBM2xJb2daUQoFCI4IGAE",
"invoices": [
{
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": false
},
"created_at": "2020-06-18T17:45:13Z",
"custom_fields": [
{
"label": "Event Reference Number",
"placement": "ABOVE_LINE_ITEMS",
"value": "Ref. #1234"
},
{
"label": "Terms of Service",
"placement": "BELOW_LINE_ITEMS",
"value": "The terms of service are..."
}
],
"delivery_method": "EMAIL",
"description": "We appreciate your business!",
"id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
"invoice_number": "inv-100",
"location_id": "ES0RJRZYEC39A",
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"payment_requests": [
{
"automatic_payment_source": "NONE",
"computed_amount_money": {
"amount": 10000,
"currency": "USD"
},
"due_date": "2030-01-24",
"reminders": [
{
"message": "Your invoice is due tomorrow",
"relative_scheduled_days": -1,
"status": "PENDING",
"uid": "beebd363-e47f-4075-8785-c235aaa7df11"
}
],
"request_type": "BALANCE",
"tipping_enabled": true,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"scheduled_at": "2030-01-13T10:00:00Z",
"status": "DRAFT",
"timezone": "America/Los_Angeles",
"title": "Event Planning Services",
"updated_at": "2020-06-18T17:45:13Z",
"version": 0
},
{
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": true
},
"created_at": "2021-01-23T15:29:12Z",
"delivery_method": "EMAIL",
"id": "inv:0-ChC366qAfskpGrBI_1bozs9mEA3",
"invoice_number": "inv-455",
"location_id": "ES0RJRZYEC39A",
"next_payment_amount_money": {
"amount": 3000,
"currency": "USD"
},
"order_id": "a65jnS8NXbfprvGJzY9F4fQTuaB",
"payment_requests": [
{
"automatic_payment_source": "CARD_ON_FILE",
"card_id": "ccof:IkWfpLj4tNHMyFii3GB",
"computed_amount_money": {
"amount": 1000,
"currency": "USD"
},
"due_date": "2021-01-23",
"percentage_requested": "25",
"request_type": "DEPOSIT",
"tipping_enabled": false,
"total_completed_amount_money": {
"amount": 1000,
"currency": "USD"
},
"uid": "66c3bdfd-5090-4ff9-a8a0-c1e1a2ffa176"
},
{
"automatic_payment_source": "CARD_ON_FILE",
"card_id": "ccof:IkWfpLj4tNHMyFii3GB",
"computed_amount_money": {
"amount": 3000,
"currency": "USD"
},
"due_date": "2021-06-15",
"request_type": "BALANCE",
"tipping_enabled": false,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "120c5e18-4f80-4f6b-b159-774cb9bf8f99"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"public_url": "https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ",
"status": "PARTIALLY_PAID",
"timezone": "America/Los_Angeles",
"updated_at": "2021-01-23T15:29:56Z",
"version": 3
}
]
}
PUT
UpdateInvoice
{{baseUrl}}/v2/invoices/:invoice_id
QUERY PARAMS
invoice_id
BODY json
{
"fields_to_clear": [],
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/invoices/:invoice_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/invoices/:invoice_id" {:content-type :json
:form-params {:fields_to_clear []
:idempotency_key ""
:invoice {:accepted_payment_methods {:bank_account false
:card false
:square_gift_card false}
:created_at ""
:custom_fields [{:label ""
:placement ""
:value ""}]
:delivery_method ""
:description ""
:id ""
:invoice_number ""
:location_id ""
:next_payment_amount_money {:amount 0
:currency ""}
:order_id ""
:payment_requests [{:automatic_payment_source ""
:card_id ""
:computed_amount_money {}
:due_date ""
:fixed_amount_requested_money {}
:percentage_requested ""
:reminders [{:message ""
:relative_scheduled_days 0
:sent_at ""
:status ""
:uid ""}]
:request_method ""
:request_type ""
:rounding_adjustment_included_money {}
:tipping_enabled false
:total_completed_amount_money {}
:uid ""}]
:primary_recipient {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:company_name ""
:customer_id ""
:email_address ""
:family_name ""
:given_name ""
:phone_number ""}
:public_url ""
:scheduled_at ""
:status ""
:subscription_id ""
:timezone ""
:title ""
:updated_at ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/invoices/:invoice_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/invoices/:invoice_id"),
Content = new StringContent("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/invoices/:invoice_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/invoices/:invoice_id"
payload := strings.NewReader("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/invoices/:invoice_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2052
{
"fields_to_clear": [],
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/invoices/:invoice_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/invoices/:invoice_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/invoices/:invoice_id")
.header("content-type", "application/json")
.body("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
fields_to_clear: [],
idempotency_key: '',
invoice: {
accepted_payment_methods: {
bank_account: false,
card: false,
square_gift_card: false
},
created_at: '',
custom_fields: [
{
label: '',
placement: '',
value: ''
}
],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {
amount: 0,
currency: ''
},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [
{
message: '',
relative_scheduled_days: 0,
sent_at: '',
status: '',
uid: ''
}
],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/invoices/:invoice_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/invoices/:invoice_id',
headers: {'content-type': 'application/json'},
data: {
fields_to_clear: [],
idempotency_key: '',
invoice: {
accepted_payment_methods: {bank_account: false, card: false, square_gift_card: false},
created_at: '',
custom_fields: [{label: '', placement: '', value: ''}],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {amount: 0, currency: ''},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [{message: '', relative_scheduled_days: 0, sent_at: '', status: '', uid: ''}],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/invoices/:invoice_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"fields_to_clear":[],"idempotency_key":"","invoice":{"accepted_payment_methods":{"bank_account":false,"card":false,"square_gift_card":false},"created_at":"","custom_fields":[{"label":"","placement":"","value":""}],"delivery_method":"","description":"","id":"","invoice_number":"","location_id":"","next_payment_amount_money":{"amount":0,"currency":""},"order_id":"","payment_requests":[{"automatic_payment_source":"","card_id":"","computed_amount_money":{},"due_date":"","fixed_amount_requested_money":{},"percentage_requested":"","reminders":[{"message":"","relative_scheduled_days":0,"sent_at":"","status":"","uid":""}],"request_method":"","request_type":"","rounding_adjustment_included_money":{},"tipping_enabled":false,"total_completed_amount_money":{},"uid":""}],"primary_recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"company_name":"","customer_id":"","email_address":"","family_name":"","given_name":"","phone_number":""},"public_url":"","scheduled_at":"","status":"","subscription_id":"","timezone":"","title":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/invoices/:invoice_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "fields_to_clear": [],\n "idempotency_key": "",\n "invoice": {\n "accepted_payment_methods": {\n "bank_account": false,\n "card": false,\n "square_gift_card": false\n },\n "created_at": "",\n "custom_fields": [\n {\n "label": "",\n "placement": "",\n "value": ""\n }\n ],\n "delivery_method": "",\n "description": "",\n "id": "",\n "invoice_number": "",\n "location_id": "",\n "next_payment_amount_money": {\n "amount": 0,\n "currency": ""\n },\n "order_id": "",\n "payment_requests": [\n {\n "automatic_payment_source": "",\n "card_id": "",\n "computed_amount_money": {},\n "due_date": "",\n "fixed_amount_requested_money": {},\n "percentage_requested": "",\n "reminders": [\n {\n "message": "",\n "relative_scheduled_days": 0,\n "sent_at": "",\n "status": "",\n "uid": ""\n }\n ],\n "request_method": "",\n "request_type": "",\n "rounding_adjustment_included_money": {},\n "tipping_enabled": false,\n "total_completed_amount_money": {},\n "uid": ""\n }\n ],\n "primary_recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "company_name": "",\n "customer_id": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "phone_number": ""\n },\n "public_url": "",\n "scheduled_at": "",\n "status": "",\n "subscription_id": "",\n "timezone": "",\n "title": "",\n "updated_at": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/invoices/:invoice_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/invoices/:invoice_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
fields_to_clear: [],
idempotency_key: '',
invoice: {
accepted_payment_methods: {bank_account: false, card: false, square_gift_card: false},
created_at: '',
custom_fields: [{label: '', placement: '', value: ''}],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {amount: 0, currency: ''},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [{message: '', relative_scheduled_days: 0, sent_at: '', status: '', uid: ''}],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/invoices/:invoice_id',
headers: {'content-type': 'application/json'},
body: {
fields_to_clear: [],
idempotency_key: '',
invoice: {
accepted_payment_methods: {bank_account: false, card: false, square_gift_card: false},
created_at: '',
custom_fields: [{label: '', placement: '', value: ''}],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {amount: 0, currency: ''},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [{message: '', relative_scheduled_days: 0, sent_at: '', status: '', uid: ''}],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/invoices/:invoice_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
fields_to_clear: [],
idempotency_key: '',
invoice: {
accepted_payment_methods: {
bank_account: false,
card: false,
square_gift_card: false
},
created_at: '',
custom_fields: [
{
label: '',
placement: '',
value: ''
}
],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {
amount: 0,
currency: ''
},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [
{
message: '',
relative_scheduled_days: 0,
sent_at: '',
status: '',
uid: ''
}
],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/invoices/:invoice_id',
headers: {'content-type': 'application/json'},
data: {
fields_to_clear: [],
idempotency_key: '',
invoice: {
accepted_payment_methods: {bank_account: false, card: false, square_gift_card: false},
created_at: '',
custom_fields: [{label: '', placement: '', value: ''}],
delivery_method: '',
description: '',
id: '',
invoice_number: '',
location_id: '',
next_payment_amount_money: {amount: 0, currency: ''},
order_id: '',
payment_requests: [
{
automatic_payment_source: '',
card_id: '',
computed_amount_money: {},
due_date: '',
fixed_amount_requested_money: {},
percentage_requested: '',
reminders: [{message: '', relative_scheduled_days: 0, sent_at: '', status: '', uid: ''}],
request_method: '',
request_type: '',
rounding_adjustment_included_money: {},
tipping_enabled: false,
total_completed_amount_money: {},
uid: ''
}
],
primary_recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
company_name: '',
customer_id: '',
email_address: '',
family_name: '',
given_name: '',
phone_number: ''
},
public_url: '',
scheduled_at: '',
status: '',
subscription_id: '',
timezone: '',
title: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/invoices/:invoice_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"fields_to_clear":[],"idempotency_key":"","invoice":{"accepted_payment_methods":{"bank_account":false,"card":false,"square_gift_card":false},"created_at":"","custom_fields":[{"label":"","placement":"","value":""}],"delivery_method":"","description":"","id":"","invoice_number":"","location_id":"","next_payment_amount_money":{"amount":0,"currency":""},"order_id":"","payment_requests":[{"automatic_payment_source":"","card_id":"","computed_amount_money":{},"due_date":"","fixed_amount_requested_money":{},"percentage_requested":"","reminders":[{"message":"","relative_scheduled_days":0,"sent_at":"","status":"","uid":""}],"request_method":"","request_type":"","rounding_adjustment_included_money":{},"tipping_enabled":false,"total_completed_amount_money":{},"uid":""}],"primary_recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"company_name":"","customer_id":"","email_address":"","family_name":"","given_name":"","phone_number":""},"public_url":"","scheduled_at":"","status":"","subscription_id":"","timezone":"","title":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"fields_to_clear": @[ ],
@"idempotency_key": @"",
@"invoice": @{ @"accepted_payment_methods": @{ @"bank_account": @NO, @"card": @NO, @"square_gift_card": @NO }, @"created_at": @"", @"custom_fields": @[ @{ @"label": @"", @"placement": @"", @"value": @"" } ], @"delivery_method": @"", @"description": @"", @"id": @"", @"invoice_number": @"", @"location_id": @"", @"next_payment_amount_money": @{ @"amount": @0, @"currency": @"" }, @"order_id": @"", @"payment_requests": @[ @{ @"automatic_payment_source": @"", @"card_id": @"", @"computed_amount_money": @{ }, @"due_date": @"", @"fixed_amount_requested_money": @{ }, @"percentage_requested": @"", @"reminders": @[ @{ @"message": @"", @"relative_scheduled_days": @0, @"sent_at": @"", @"status": @"", @"uid": @"" } ], @"request_method": @"", @"request_type": @"", @"rounding_adjustment_included_money": @{ }, @"tipping_enabled": @NO, @"total_completed_amount_money": @{ }, @"uid": @"" } ], @"primary_recipient": @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"company_name": @"", @"customer_id": @"", @"email_address": @"", @"family_name": @"", @"given_name": @"", @"phone_number": @"" }, @"public_url": @"", @"scheduled_at": @"", @"status": @"", @"subscription_id": @"", @"timezone": @"", @"title": @"", @"updated_at": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/invoices/:invoice_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/invoices/:invoice_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/invoices/:invoice_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'fields_to_clear' => [
],
'idempotency_key' => '',
'invoice' => [
'accepted_payment_methods' => [
'bank_account' => null,
'card' => null,
'square_gift_card' => null
],
'created_at' => '',
'custom_fields' => [
[
'label' => '',
'placement' => '',
'value' => ''
]
],
'delivery_method' => '',
'description' => '',
'id' => '',
'invoice_number' => '',
'location_id' => '',
'next_payment_amount_money' => [
'amount' => 0,
'currency' => ''
],
'order_id' => '',
'payment_requests' => [
[
'automatic_payment_source' => '',
'card_id' => '',
'computed_amount_money' => [
],
'due_date' => '',
'fixed_amount_requested_money' => [
],
'percentage_requested' => '',
'reminders' => [
[
'message' => '',
'relative_scheduled_days' => 0,
'sent_at' => '',
'status' => '',
'uid' => ''
]
],
'request_method' => '',
'request_type' => '',
'rounding_adjustment_included_money' => [
],
'tipping_enabled' => null,
'total_completed_amount_money' => [
],
'uid' => ''
]
],
'primary_recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'company_name' => '',
'customer_id' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'phone_number' => ''
],
'public_url' => '',
'scheduled_at' => '',
'status' => '',
'subscription_id' => '',
'timezone' => '',
'title' => '',
'updated_at' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/invoices/:invoice_id', [
'body' => '{
"fields_to_clear": [],
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/invoices/:invoice_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'fields_to_clear' => [
],
'idempotency_key' => '',
'invoice' => [
'accepted_payment_methods' => [
'bank_account' => null,
'card' => null,
'square_gift_card' => null
],
'created_at' => '',
'custom_fields' => [
[
'label' => '',
'placement' => '',
'value' => ''
]
],
'delivery_method' => '',
'description' => '',
'id' => '',
'invoice_number' => '',
'location_id' => '',
'next_payment_amount_money' => [
'amount' => 0,
'currency' => ''
],
'order_id' => '',
'payment_requests' => [
[
'automatic_payment_source' => '',
'card_id' => '',
'computed_amount_money' => [
],
'due_date' => '',
'fixed_amount_requested_money' => [
],
'percentage_requested' => '',
'reminders' => [
[
'message' => '',
'relative_scheduled_days' => 0,
'sent_at' => '',
'status' => '',
'uid' => ''
]
],
'request_method' => '',
'request_type' => '',
'rounding_adjustment_included_money' => [
],
'tipping_enabled' => null,
'total_completed_amount_money' => [
],
'uid' => ''
]
],
'primary_recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'company_name' => '',
'customer_id' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'phone_number' => ''
],
'public_url' => '',
'scheduled_at' => '',
'status' => '',
'subscription_id' => '',
'timezone' => '',
'title' => '',
'updated_at' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'fields_to_clear' => [
],
'idempotency_key' => '',
'invoice' => [
'accepted_payment_methods' => [
'bank_account' => null,
'card' => null,
'square_gift_card' => null
],
'created_at' => '',
'custom_fields' => [
[
'label' => '',
'placement' => '',
'value' => ''
]
],
'delivery_method' => '',
'description' => '',
'id' => '',
'invoice_number' => '',
'location_id' => '',
'next_payment_amount_money' => [
'amount' => 0,
'currency' => ''
],
'order_id' => '',
'payment_requests' => [
[
'automatic_payment_source' => '',
'card_id' => '',
'computed_amount_money' => [
],
'due_date' => '',
'fixed_amount_requested_money' => [
],
'percentage_requested' => '',
'reminders' => [
[
'message' => '',
'relative_scheduled_days' => 0,
'sent_at' => '',
'status' => '',
'uid' => ''
]
],
'request_method' => '',
'request_type' => '',
'rounding_adjustment_included_money' => [
],
'tipping_enabled' => null,
'total_completed_amount_money' => [
],
'uid' => ''
]
],
'primary_recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'company_name' => '',
'customer_id' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'phone_number' => ''
],
'public_url' => '',
'scheduled_at' => '',
'status' => '',
'subscription_id' => '',
'timezone' => '',
'title' => '',
'updated_at' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/invoices/:invoice_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/invoices/:invoice_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"fields_to_clear": [],
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/invoices/:invoice_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"fields_to_clear": [],
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/invoices/:invoice_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/invoices/:invoice_id"
payload = {
"fields_to_clear": [],
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": False,
"card": False,
"square_gift_card": False
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": False,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/invoices/:invoice_id"
payload <- "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/invoices/:invoice_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/invoices/:invoice_id') do |req|
req.body = "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"invoice\": {\n \"accepted_payment_methods\": {\n \"bank_account\": false,\n \"card\": false,\n \"square_gift_card\": false\n },\n \"created_at\": \"\",\n \"custom_fields\": [\n {\n \"label\": \"\",\n \"placement\": \"\",\n \"value\": \"\"\n }\n ],\n \"delivery_method\": \"\",\n \"description\": \"\",\n \"id\": \"\",\n \"invoice_number\": \"\",\n \"location_id\": \"\",\n \"next_payment_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"order_id\": \"\",\n \"payment_requests\": [\n {\n \"automatic_payment_source\": \"\",\n \"card_id\": \"\",\n \"computed_amount_money\": {},\n \"due_date\": \"\",\n \"fixed_amount_requested_money\": {},\n \"percentage_requested\": \"\",\n \"reminders\": [\n {\n \"message\": \"\",\n \"relative_scheduled_days\": 0,\n \"sent_at\": \"\",\n \"status\": \"\",\n \"uid\": \"\"\n }\n ],\n \"request_method\": \"\",\n \"request_type\": \"\",\n \"rounding_adjustment_included_money\": {},\n \"tipping_enabled\": false,\n \"total_completed_amount_money\": {},\n \"uid\": \"\"\n }\n ],\n \"primary_recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"company_name\": \"\",\n \"customer_id\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"phone_number\": \"\"\n },\n \"public_url\": \"\",\n \"scheduled_at\": \"\",\n \"status\": \"\",\n \"subscription_id\": \"\",\n \"timezone\": \"\",\n \"title\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/invoices/:invoice_id";
let payload = json!({
"fields_to_clear": (),
"idempotency_key": "",
"invoice": json!({
"accepted_payment_methods": json!({
"bank_account": false,
"card": false,
"square_gift_card": false
}),
"created_at": "",
"custom_fields": (
json!({
"label": "",
"placement": "",
"value": ""
})
),
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": json!({
"amount": 0,
"currency": ""
}),
"order_id": "",
"payment_requests": (
json!({
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": json!({}),
"due_date": "",
"fixed_amount_requested_money": json!({}),
"percentage_requested": "",
"reminders": (
json!({
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
})
),
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": json!({}),
"tipping_enabled": false,
"total_completed_amount_money": json!({}),
"uid": ""
})
),
"primary_recipient": json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
}),
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/invoices/:invoice_id \
--header 'content-type: application/json' \
--data '{
"fields_to_clear": [],
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}'
echo '{
"fields_to_clear": [],
"idempotency_key": "",
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": false,
"square_gift_card": false
},
"created_at": "",
"custom_fields": [
{
"label": "",
"placement": "",
"value": ""
}
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": {
"amount": 0,
"currency": ""
},
"order_id": "",
"payment_requests": [
{
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": {},
"due_date": "",
"fixed_amount_requested_money": {},
"percentage_requested": "",
"reminders": [
{
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
}
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": {},
"tipping_enabled": false,
"total_completed_amount_money": {},
"uid": ""
}
],
"primary_recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
},
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
}
}' | \
http PUT {{baseUrl}}/v2/invoices/:invoice_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "fields_to_clear": [],\n "idempotency_key": "",\n "invoice": {\n "accepted_payment_methods": {\n "bank_account": false,\n "card": false,\n "square_gift_card": false\n },\n "created_at": "",\n "custom_fields": [\n {\n "label": "",\n "placement": "",\n "value": ""\n }\n ],\n "delivery_method": "",\n "description": "",\n "id": "",\n "invoice_number": "",\n "location_id": "",\n "next_payment_amount_money": {\n "amount": 0,\n "currency": ""\n },\n "order_id": "",\n "payment_requests": [\n {\n "automatic_payment_source": "",\n "card_id": "",\n "computed_amount_money": {},\n "due_date": "",\n "fixed_amount_requested_money": {},\n "percentage_requested": "",\n "reminders": [\n {\n "message": "",\n "relative_scheduled_days": 0,\n "sent_at": "",\n "status": "",\n "uid": ""\n }\n ],\n "request_method": "",\n "request_type": "",\n "rounding_adjustment_included_money": {},\n "tipping_enabled": false,\n "total_completed_amount_money": {},\n "uid": ""\n }\n ],\n "primary_recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "company_name": "",\n "customer_id": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "phone_number": ""\n },\n "public_url": "",\n "scheduled_at": "",\n "status": "",\n "subscription_id": "",\n "timezone": "",\n "title": "",\n "updated_at": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/invoices/:invoice_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"fields_to_clear": [],
"idempotency_key": "",
"invoice": [
"accepted_payment_methods": [
"bank_account": false,
"card": false,
"square_gift_card": false
],
"created_at": "",
"custom_fields": [
[
"label": "",
"placement": "",
"value": ""
]
],
"delivery_method": "",
"description": "",
"id": "",
"invoice_number": "",
"location_id": "",
"next_payment_amount_money": [
"amount": 0,
"currency": ""
],
"order_id": "",
"payment_requests": [
[
"automatic_payment_source": "",
"card_id": "",
"computed_amount_money": [],
"due_date": "",
"fixed_amount_requested_money": [],
"percentage_requested": "",
"reminders": [
[
"message": "",
"relative_scheduled_days": 0,
"sent_at": "",
"status": "",
"uid": ""
]
],
"request_method": "",
"request_type": "",
"rounding_adjustment_included_money": [],
"tipping_enabled": false,
"total_completed_amount_money": [],
"uid": ""
]
],
"primary_recipient": [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"company_name": "",
"customer_id": "",
"email_address": "",
"family_name": "",
"given_name": "",
"phone_number": ""
],
"public_url": "",
"scheduled_at": "",
"status": "",
"subscription_id": "",
"timezone": "",
"title": "",
"updated_at": "",
"version": 0
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/invoices/:invoice_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"invoice": {
"accepted_payment_methods": {
"bank_account": false,
"card": true,
"square_gift_card": false
},
"created_at": "2020-06-18T17:45:13Z",
"custom_fields": [
{
"label": "Event Reference Number",
"placement": "ABOVE_LINE_ITEMS",
"value": "Ref. #1234"
},
{
"label": "Terms of Service",
"placement": "BELOW_LINE_ITEMS",
"value": "The terms of service are..."
}
],
"delivery_method": "EMAIL",
"description": "We appreciate your business!",
"id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY",
"invoice_number": "inv-100",
"location_id": "ES0RJRZYEC39A",
"next_payment_amount_money": {
"amount": 10000,
"currency": "USD"
},
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"payment_requests": [
{
"automatic_payment_source": "NONE",
"computed_amount_money": {
"amount": 10000,
"currency": "USD"
},
"due_date": "2030-01-24",
"request_type": "BALANCE",
"tipping_enabled": false,
"total_completed_amount_money": {
"amount": 0,
"currency": "USD"
},
"uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355"
}
],
"primary_recipient": {
"customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4",
"email_address": "Amelia.Earhart@example.com",
"family_name": "Earhart",
"given_name": "Amelia",
"phone_number": "1-212-555-4240"
},
"scheduled_at": "2030-01-13T10:00:00Z",
"status": "UNPAID",
"timezone": "America/Los_Angeles",
"title": "Event Planning Services",
"updated_at": "2020-06-18T18:23:11Z",
"version": 2
}
}
POST
CreateBreakType
{{baseUrl}}/v2/labor/break-types
BODY json
{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/break-types");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/labor/break-types" {:content-type :json
:form-params {:break_type {:break_name ""
:created_at ""
:expected_duration ""
:id ""
:is_paid false
:location_id ""
:updated_at ""
:version 0}
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/labor/break-types"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/labor/break-types"),
Content = new StringContent("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/break-types");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/break-types"
payload := strings.NewReader("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/labor/break-types HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 221
{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/labor/break-types")
.setHeader("content-type", "application/json")
.setBody("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/break-types"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/labor/break-types")
.header("content-type", "application/json")
.body("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
},
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/labor/break-types');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/break-types',
headers: {'content-type': 'application/json'},
data: {
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/break-types';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"break_type":{"break_name":"","created_at":"","expected_duration":"","id":"","is_paid":false,"location_id":"","updated_at":"","version":0},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/break-types',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "break_type": {\n "break_name": "",\n "created_at": "",\n "expected_duration": "",\n "id": "",\n "is_paid": false,\n "location_id": "",\n "updated_at": "",\n "version": 0\n },\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/break-types',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/break-types',
headers: {'content-type': 'application/json'},
body: {
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
},
idempotency_key: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/labor/break-types');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
},
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/break-types',
headers: {'content-type': 'application/json'},
data: {
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/break-types';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"break_type":{"break_name":"","created_at":"","expected_duration":"","id":"","is_paid":false,"location_id":"","updated_at":"","version":0},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"break_type": @{ @"break_name": @"", @"created_at": @"", @"expected_duration": @"", @"id": @"", @"is_paid": @NO, @"location_id": @"", @"updated_at": @"", @"version": @0 },
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/break-types"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/break-types" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/break-types",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'break_type' => [
'break_name' => '',
'created_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'location_id' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/labor/break-types', [
'body' => '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/break-types');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'break_type' => [
'break_name' => '',
'created_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'location_id' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'break_type' => [
'break_name' => '',
'created_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'location_id' => '',
'updated_at' => '',
'version' => 0
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/labor/break-types');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/break-types' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/break-types' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/labor/break-types", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/break-types"
payload = {
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": False,
"location_id": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/break-types"
payload <- "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/break-types")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/labor/break-types') do |req|
req.body = "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/break-types";
let payload = json!({
"break_type": json!({
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
}),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/labor/break-types \
--header 'content-type: application/json' \
--data '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}'
echo '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
},
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/labor/break-types \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "break_type": {\n "break_name": "",\n "created_at": "",\n "expected_duration": "",\n "id": "",\n "is_paid": false,\n "location_id": "",\n "updated_at": "",\n "version": 0\n },\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/labor/break-types
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"break_type": [
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/break-types")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"break_type": {
"break_name": "Lunch Break",
"created_at": "2019-02-26T22:42:54Z",
"expected_duration": "PT30M",
"id": "49SSVDJG76WF3",
"is_paid": true,
"location_id": "CGJN03P1D08GF",
"updated_at": "2019-02-26T22:42:54Z",
"version": 1
}
}
POST
CreateShift
{{baseUrl}}/v2/labor/shifts
BODY json
{
"idempotency_key": "",
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/shifts");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/labor/shifts" {:content-type :json
:form-params {:idempotency_key ""
:shift {:breaks [{:break_type_id ""
:end_at ""
:expected_duration ""
:id ""
:is_paid false
:name ""
:start_at ""}]
:created_at ""
:employee_id ""
:end_at ""
:id ""
:location_id ""
:start_at ""
:status ""
:team_member_id ""
:timezone ""
:updated_at ""
:version 0
:wage {:hourly_rate {:amount 0
:currency ""}
:title ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/labor/shifts"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/labor/shifts"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/shifts");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/shifts"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/labor/shifts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 593
{
"idempotency_key": "",
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/labor/shifts")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/shifts"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/labor/shifts")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {
hourly_rate: {
amount: 0,
currency: ''
},
title: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/labor/shifts');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/shifts',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {hourly_rate: {amount: 0, currency: ''}, title: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/shifts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","shift":{"breaks":[{"break_type_id":"","end_at":"","expected_duration":"","id":"","is_paid":false,"name":"","start_at":""}],"created_at":"","employee_id":"","end_at":"","id":"","location_id":"","start_at":"","status":"","team_member_id":"","timezone":"","updated_at":"","version":0,"wage":{"hourly_rate":{"amount":0,"currency":""},"title":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/shifts',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "shift": {\n "breaks": [\n {\n "break_type_id": "",\n "end_at": "",\n "expected_duration": "",\n "id": "",\n "is_paid": false,\n "name": "",\n "start_at": ""\n }\n ],\n "created_at": "",\n "employee_id": "",\n "end_at": "",\n "id": "",\n "location_id": "",\n "start_at": "",\n "status": "",\n "team_member_id": "",\n "timezone": "",\n "updated_at": "",\n "version": 0,\n "wage": {\n "hourly_rate": {\n "amount": 0,\n "currency": ""\n },\n "title": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/shifts',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {hourly_rate: {amount: 0, currency: ''}, title: ''}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/shifts',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {hourly_rate: {amount: 0, currency: ''}, title: ''}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/labor/shifts');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {
hourly_rate: {
amount: 0,
currency: ''
},
title: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/shifts',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {hourly_rate: {amount: 0, currency: ''}, title: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/shifts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","shift":{"breaks":[{"break_type_id":"","end_at":"","expected_duration":"","id":"","is_paid":false,"name":"","start_at":""}],"created_at":"","employee_id":"","end_at":"","id":"","location_id":"","start_at":"","status":"","team_member_id":"","timezone":"","updated_at":"","version":0,"wage":{"hourly_rate":{"amount":0,"currency":""},"title":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"shift": @{ @"breaks": @[ @{ @"break_type_id": @"", @"end_at": @"", @"expected_duration": @"", @"id": @"", @"is_paid": @NO, @"name": @"", @"start_at": @"" } ], @"created_at": @"", @"employee_id": @"", @"end_at": @"", @"id": @"", @"location_id": @"", @"start_at": @"", @"status": @"", @"team_member_id": @"", @"timezone": @"", @"updated_at": @"", @"version": @0, @"wage": @{ @"hourly_rate": @{ @"amount": @0, @"currency": @"" }, @"title": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/shifts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/shifts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/shifts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'shift' => [
'breaks' => [
[
'break_type_id' => '',
'end_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'name' => '',
'start_at' => ''
]
],
'created_at' => '',
'employee_id' => '',
'end_at' => '',
'id' => '',
'location_id' => '',
'start_at' => '',
'status' => '',
'team_member_id' => '',
'timezone' => '',
'updated_at' => '',
'version' => 0,
'wage' => [
'hourly_rate' => [
'amount' => 0,
'currency' => ''
],
'title' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/labor/shifts', [
'body' => '{
"idempotency_key": "",
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/shifts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'shift' => [
'breaks' => [
[
'break_type_id' => '',
'end_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'name' => '',
'start_at' => ''
]
],
'created_at' => '',
'employee_id' => '',
'end_at' => '',
'id' => '',
'location_id' => '',
'start_at' => '',
'status' => '',
'team_member_id' => '',
'timezone' => '',
'updated_at' => '',
'version' => 0,
'wage' => [
'hourly_rate' => [
'amount' => 0,
'currency' => ''
],
'title' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'shift' => [
'breaks' => [
[
'break_type_id' => '',
'end_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'name' => '',
'start_at' => ''
]
],
'created_at' => '',
'employee_id' => '',
'end_at' => '',
'id' => '',
'location_id' => '',
'start_at' => '',
'status' => '',
'team_member_id' => '',
'timezone' => '',
'updated_at' => '',
'version' => 0,
'wage' => [
'hourly_rate' => [
'amount' => 0,
'currency' => ''
],
'title' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/labor/shifts');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/shifts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/shifts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/labor/shifts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/shifts"
payload = {
"idempotency_key": "",
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": False,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/shifts"
payload <- "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/shifts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/labor/shifts') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/shifts";
let payload = json!({
"idempotency_key": "",
"shift": json!({
"breaks": (
json!({
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
})
),
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": json!({
"hourly_rate": json!({
"amount": 0,
"currency": ""
}),
"title": ""
})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/labor/shifts \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}'
echo '{
"idempotency_key": "",
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}' | \
http POST {{baseUrl}}/v2/labor/shifts \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "shift": {\n "breaks": [\n {\n "break_type_id": "",\n "end_at": "",\n "expected_duration": "",\n "id": "",\n "is_paid": false,\n "name": "",\n "start_at": ""\n }\n ],\n "created_at": "",\n "employee_id": "",\n "end_at": "",\n "id": "",\n "location_id": "",\n "start_at": "",\n "status": "",\n "team_member_id": "",\n "timezone": "",\n "updated_at": "",\n "version": 0,\n "wage": {\n "hourly_rate": {\n "amount": 0,\n "currency": ""\n },\n "title": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/labor/shifts
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"shift": [
"breaks": [
[
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
]
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": [
"hourly_rate": [
"amount": 0,
"currency": ""
],
"title": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/shifts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"shift": {
"breaks": [
{
"break_type_id": "REGS1EQR1TPZ5",
"end_at": "2019-01-25T06:16:00-05:00",
"expected_duration": "PT5M",
"id": "X7GAQYVVRRG6P",
"is_paid": true,
"name": "Tea Break",
"start_at": "2019-01-25T06:11:00-05:00"
}
],
"created_at": "2019-02-28T00:39:02Z",
"employee_id": "ormj0jJJZ5OZIzxrZYJI",
"end_at": "2019-01-25T13:11:00-05:00",
"id": "K0YH4CV5462JB",
"location_id": "PAA1RJZZKXBFG",
"start_at": "2019-01-25T03:11:00-05:00",
"status": "CLOSED",
"team_member_id": "ormj0jJJZ5OZIzxrZYJI",
"timezone": "America/New_York",
"updated_at": "2019-02-28T00:39:02Z",
"version": 1,
"wage": {
"hourly_rate": {
"amount": 1100,
"currency": "USD"
},
"title": "Barista"
}
}
}
DELETE
DeleteBreakType
{{baseUrl}}/v2/labor/break-types/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/break-types/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/labor/break-types/:id")
require "http/client"
url = "{{baseUrl}}/v2/labor/break-types/:id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/labor/break-types/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/break-types/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/break-types/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/labor/break-types/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/labor/break-types/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/break-types/:id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/labor/break-types/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/labor/break-types/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/labor/break-types/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/break-types/:id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/break-types/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types/:id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/break-types/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/labor/break-types/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/labor/break-types/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/labor/break-types/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/break-types/:id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/break-types/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/break-types/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/break-types/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/labor/break-types/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/break-types/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/break-types/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/break-types/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/break-types/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/labor/break-types/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/break-types/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/break-types/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/break-types/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/labor/break-types/:id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/break-types/:id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/labor/break-types/:id
http DELETE {{baseUrl}}/v2/labor/break-types/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/labor/break-types/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/break-types/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
DELETE
DeleteShift
{{baseUrl}}/v2/labor/shifts/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/shifts/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/labor/shifts/:id")
require "http/client"
url = "{{baseUrl}}/v2/labor/shifts/:id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/labor/shifts/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/shifts/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/shifts/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/labor/shifts/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/labor/shifts/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/shifts/:id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/labor/shifts/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/labor/shifts/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/labor/shifts/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/shifts/:id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/shifts/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts/:id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/shifts/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/labor/shifts/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/labor/shifts/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/labor/shifts/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/shifts/:id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/shifts/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/shifts/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/shifts/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/labor/shifts/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/shifts/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/shifts/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/shifts/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/shifts/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/labor/shifts/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/shifts/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/shifts/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/shifts/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/labor/shifts/:id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/shifts/:id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/labor/shifts/:id
http DELETE {{baseUrl}}/v2/labor/shifts/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/labor/shifts/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/shifts/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
GET
GetBreakType
{{baseUrl}}/v2/labor/break-types/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/break-types/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/labor/break-types/:id")
require "http/client"
url = "{{baseUrl}}/v2/labor/break-types/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/labor/break-types/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/break-types/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/break-types/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/labor/break-types/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/labor/break-types/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/break-types/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/labor/break-types/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/labor/break-types/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/break-types/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/break-types/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/break-types/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/break-types/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/break-types/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/labor/break-types/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/break-types/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/break-types/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/break-types/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/break-types/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/break-types/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/labor/break-types/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/break-types/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/break-types/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/break-types/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/break-types/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/labor/break-types/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/break-types/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/break-types/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/break-types/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/labor/break-types/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/break-types/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/labor/break-types/:id
http GET {{baseUrl}}/v2/labor/break-types/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/labor/break-types/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/break-types/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"break_type": {
"break_name": "Lunch Break",
"created_at": "2019-02-21T17:50:00Z",
"expected_duration": "PT30M",
"id": "lA0mj_RSOprNPwMUXdYp",
"is_paid": true,
"location_id": "059SB0E0WCNWS",
"updated_at": "2019-02-21T17:50:00Z",
"version": 1
}
}
GET
GetEmployeeWage
{{baseUrl}}/v2/labor/employee-wages/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/employee-wages/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/labor/employee-wages/:id")
require "http/client"
url = "{{baseUrl}}/v2/labor/employee-wages/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/labor/employee-wages/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/employee-wages/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/employee-wages/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/labor/employee-wages/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/labor/employee-wages/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/employee-wages/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/employee-wages/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/labor/employee-wages/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/labor/employee-wages/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/employee-wages/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/employee-wages/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/employee-wages/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/employee-wages/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/employee-wages/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/employee-wages/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/labor/employee-wages/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/employee-wages/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/employee-wages/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/employee-wages/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/employee-wages/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/employee-wages/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/labor/employee-wages/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/employee-wages/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/employee-wages/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/employee-wages/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/employee-wages/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/labor/employee-wages/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/employee-wages/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/employee-wages/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/employee-wages/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/labor/employee-wages/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/employee-wages/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/labor/employee-wages/:id
http GET {{baseUrl}}/v2/labor/employee-wages/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/labor/employee-wages/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/employee-wages/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"employee_wage": {
"employee_id": "33fJchumvVdJwxV0H6L9",
"hourly_rate": {
"amount": 2000,
"currency": "USD"
},
"id": "pXS3qCv7BERPnEGedM4S8mhm",
"title": "Manager"
}
}
GET
GetShift
{{baseUrl}}/v2/labor/shifts/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/shifts/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/labor/shifts/:id")
require "http/client"
url = "{{baseUrl}}/v2/labor/shifts/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/labor/shifts/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/shifts/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/shifts/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/labor/shifts/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/labor/shifts/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/shifts/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/labor/shifts/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/labor/shifts/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/shifts/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/shifts/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/shifts/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/shifts/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/shifts/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/labor/shifts/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/shifts/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/shifts/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/shifts/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/shifts/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/shifts/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/labor/shifts/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/shifts/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/shifts/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/shifts/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/shifts/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/labor/shifts/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/shifts/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/shifts/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/shifts/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/labor/shifts/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/shifts/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/labor/shifts/:id
http GET {{baseUrl}}/v2/labor/shifts/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/labor/shifts/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/shifts/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"shift": {
"breaks": [
{
"break_type_id": "92EPDRQKJ5088",
"end_at": "2019-02-23T20:00:00-05:00",
"expected_duration": "PT1H",
"id": "M9BBKEPQAQD2T",
"is_paid": true,
"name": "Lunch Break",
"start_at": "2019-02-23T19:00:00-05:00"
}
],
"created_at": "2019-02-27T00:12:12Z",
"employee_id": "D71KRMQof6cXGUW0aAv7",
"end_at": "2019-02-23T21:00:00-05:00",
"id": "T35HMQSN89SV4",
"location_id": "PAA1RJZZKXBFG",
"start_at": "2019-02-23T18:00:00-05:00",
"status": "CLOSED",
"team_member_id": "D71KRMQof6cXGUW0aAv7",
"timezone": "America/New_York",
"updated_at": "2019-02-27T00:12:12Z",
"version": 1,
"wage": {
"hourly_rate": {
"amount": 1457,
"currency": "USD"
},
"title": "Cashier"
}
}
}
GET
GetTeamMemberWage
{{baseUrl}}/v2/labor/team-member-wages/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/team-member-wages/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/labor/team-member-wages/:id")
require "http/client"
url = "{{baseUrl}}/v2/labor/team-member-wages/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/labor/team-member-wages/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/team-member-wages/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/team-member-wages/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/labor/team-member-wages/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/labor/team-member-wages/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/team-member-wages/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/team-member-wages/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/labor/team-member-wages/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/labor/team-member-wages/:id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/labor/team-member-wages/:id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/team-member-wages/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/team-member-wages/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/team-member-wages/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/team-member-wages/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/labor/team-member-wages/:id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/labor/team-member-wages/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/labor/team-member-wages/:id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/team-member-wages/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/team-member-wages/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/team-member-wages/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/team-member-wages/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/labor/team-member-wages/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/team-member-wages/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/team-member-wages/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/team-member-wages/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/team-member-wages/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/labor/team-member-wages/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/team-member-wages/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/team-member-wages/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/team-member-wages/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/labor/team-member-wages/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/team-member-wages/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/labor/team-member-wages/:id
http GET {{baseUrl}}/v2/labor/team-member-wages/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/labor/team-member-wages/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/team-member-wages/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"team_member_wage": {
"hourly_rate": {
"amount": 2000,
"currency": "USD"
},
"id": "pXS3qCv7BERPnEGedM4S8mhm",
"team_member_id": "33fJchumvVdJwxV0H6L9",
"title": "Manager"
}
}
GET
ListBreakTypes
{{baseUrl}}/v2/labor/break-types
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/break-types");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/labor/break-types")
require "http/client"
url = "{{baseUrl}}/v2/labor/break-types"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/labor/break-types"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/break-types");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/break-types"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/labor/break-types HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/labor/break-types")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/break-types"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/labor/break-types")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/labor/break-types');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/break-types'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/break-types';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/break-types',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/break-types',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/break-types'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/labor/break-types');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/break-types'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/break-types';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/break-types"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/break-types" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/break-types",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/labor/break-types');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/break-types');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/break-types');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/break-types' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/break-types' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/labor/break-types")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/break-types"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/break-types"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/break-types")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/labor/break-types') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/break-types";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/labor/break-types
http GET {{baseUrl}}/v2/labor/break-types
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/labor/break-types
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/break-types")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"break_types": [
{
"break_name": "Coffee Break",
"created_at": "2019-01-22T20:47:37Z",
"expected_duration": "PT5M",
"id": "REGS1EQR1TPZ5",
"is_paid": false,
"location_id": "PAA1RJZZKXBFG",
"updated_at": "2019-01-22T20:47:37Z",
"version": 1
},
{
"break_name": "Lunch Break",
"created_at": "2019-01-25T19:26:30Z",
"expected_duration": "PT1H",
"id": "92EPDRQKJ5088",
"is_paid": true,
"location_id": "PAA1RJZZKXBFG",
"updated_at": "2019-01-25T19:26:30Z",
"version": 3
}
],
"cursor": "2fofTniCgT0yIPAq26kmk0YyFQJZfbWkh73OOnlTHmTAx13NgED"
}
GET
ListEmployeeWages
{{baseUrl}}/v2/labor/employee-wages
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/employee-wages");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/labor/employee-wages")
require "http/client"
url = "{{baseUrl}}/v2/labor/employee-wages"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/labor/employee-wages"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/employee-wages");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/employee-wages"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/labor/employee-wages HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/labor/employee-wages")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/employee-wages"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/employee-wages")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/labor/employee-wages")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/labor/employee-wages');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/employee-wages'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/employee-wages';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/employee-wages',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/employee-wages")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/employee-wages',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/employee-wages'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/labor/employee-wages');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/employee-wages'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/employee-wages';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/employee-wages"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/employee-wages" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/employee-wages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/labor/employee-wages');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/employee-wages');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/employee-wages');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/employee-wages' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/employee-wages' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/labor/employee-wages")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/employee-wages"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/employee-wages"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/employee-wages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/labor/employee-wages') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/employee-wages";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/labor/employee-wages
http GET {{baseUrl}}/v2/labor/employee-wages
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/labor/employee-wages
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/employee-wages")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "2fofTniCgT0yIPAq26kmk0YyFQJZfbWkh73OOnlTHmTAx13NgED",
"employee_wages": [
{
"employee_id": "33fJchumvVdJwxV0H6L9",
"hourly_rate": {
"amount": 3250,
"currency": "USD"
},
"id": "pXS3qCv7BERPnEGedM4S8mhm",
"title": "Manager"
},
{
"employee_id": "33fJchumvVdJwxV0H6L9",
"hourly_rate": {
"amount": 2600,
"currency": "USD"
},
"id": "rZduCkzYDUVL3ovh1sQgbue6",
"title": "Cook"
},
{
"employee_id": "33fJchumvVdJwxV0H6L9",
"hourly_rate": {
"amount": 1600,
"currency": "USD"
},
"id": "FxLbs5KpPUHa8wyt5ctjubDX",
"title": "Barista"
},
{
"employee_id": "33fJchumvVdJwxV0H6L9",
"hourly_rate": {
"amount": 1700,
"currency": "USD"
},
"id": "vD1wCgijMDR3cX5TPnu7VXto",
"title": "Cashier"
}
]
}
GET
ListTeamMemberWages
{{baseUrl}}/v2/labor/team-member-wages
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/team-member-wages");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/labor/team-member-wages")
require "http/client"
url = "{{baseUrl}}/v2/labor/team-member-wages"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/labor/team-member-wages"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/team-member-wages");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/team-member-wages"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/labor/team-member-wages HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/labor/team-member-wages")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/team-member-wages"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/team-member-wages")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/labor/team-member-wages")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/labor/team-member-wages');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/team-member-wages'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/team-member-wages';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/team-member-wages',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/team-member-wages")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/team-member-wages',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/team-member-wages'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/labor/team-member-wages');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/team-member-wages'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/team-member-wages';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/team-member-wages"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/team-member-wages" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/team-member-wages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/labor/team-member-wages');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/team-member-wages');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/team-member-wages');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/team-member-wages' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/team-member-wages' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/labor/team-member-wages")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/team-member-wages"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/team-member-wages"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/team-member-wages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/labor/team-member-wages') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/team-member-wages";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/labor/team-member-wages
http GET {{baseUrl}}/v2/labor/team-member-wages
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/labor/team-member-wages
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/team-member-wages")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "2fofTniCgT0yIPAq26kmk0YyFQJZfbWkh73OOnlTHmTAx13NgED",
"team_member_wages": [
{
"hourly_rate": {
"amount": 3250,
"currency": "USD"
},
"id": "pXS3qCv7BERPnEGedM4S8mhm",
"team_member_id": "33fJchumvVdJwxV0H6L9",
"title": "Manager"
},
{
"hourly_rate": {
"amount": 2600,
"currency": "USD"
},
"id": "rZduCkzYDUVL3ovh1sQgbue6",
"team_member_id": "33fJchumvVdJwxV0H6L9",
"title": "Cook"
},
{
"hourly_rate": {
"amount": 1600,
"currency": "USD"
},
"id": "FxLbs5KpPUHa8wyt5ctjubDX",
"team_member_id": "33fJchumvVdJwxV0H6L9",
"title": "Barista"
},
{
"hourly_rate": {
"amount": 1700,
"currency": "USD"
},
"id": "vD1wCgijMDR3cX5TPnu7VXto",
"team_member_id": "33fJchumvVdJwxV0H6L9",
"title": "Cashier"
}
]
}
GET
ListWorkweekConfigs
{{baseUrl}}/v2/labor/workweek-configs
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/workweek-configs");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/labor/workweek-configs")
require "http/client"
url = "{{baseUrl}}/v2/labor/workweek-configs"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/labor/workweek-configs"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/workweek-configs");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/workweek-configs"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/labor/workweek-configs HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/labor/workweek-configs")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/workweek-configs"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/workweek-configs")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/labor/workweek-configs")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/labor/workweek-configs');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/workweek-configs'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/workweek-configs';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/workweek-configs',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/workweek-configs")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/workweek-configs',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/workweek-configs'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/labor/workweek-configs');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/labor/workweek-configs'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/workweek-configs';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/workweek-configs"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/workweek-configs" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/workweek-configs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/labor/workweek-configs');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/workweek-configs');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/labor/workweek-configs');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/workweek-configs' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/workweek-configs' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/labor/workweek-configs")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/workweek-configs"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/workweek-configs"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/workweek-configs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/labor/workweek-configs') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/workweek-configs";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/labor/workweek-configs
http GET {{baseUrl}}/v2/labor/workweek-configs
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/labor/workweek-configs
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/workweek-configs")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "2fofTniCgT0yIPAq26kmk0YyFQJZfbWkh73OOnlTHmTAx13NgED",
"workweek_configs": [
{
"created_at": "2016-02-04T00:58:24Z",
"id": "FY4VCAQN700GM",
"start_of_day_local_time": "10:00",
"start_of_week": "MON",
"updated_at": "2019-02-28T01:04:35Z",
"version": 11
}
]
}
POST
SearchShifts
{{baseUrl}}/v2/labor/shifts/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"employee_ids": [],
"end": {
"end_at": "",
"start_at": ""
},
"location_ids": [],
"start": {},
"status": "",
"team_member_ids": [],
"workday": {
"date_range": {
"end_date": "",
"start_date": ""
},
"default_timezone": "",
"match_shifts_by": ""
}
},
"sort": {
"field": "",
"order": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/shifts/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/labor/shifts/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:filter {:employee_ids []
:end {:end_at ""
:start_at ""}
:location_ids []
:start {}
:status ""
:team_member_ids []
:workday {:date_range {:end_date ""
:start_date ""}
:default_timezone ""
:match_shifts_by ""}}
:sort {:field ""
:order ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/labor/shifts/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/labor/shifts/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/shifts/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/shifts/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/labor/shifts/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 496
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"employee_ids": [],
"end": {
"end_at": "",
"start_at": ""
},
"location_ids": [],
"start": {},
"status": "",
"team_member_ids": [],
"workday": {
"date_range": {
"end_date": "",
"start_date": ""
},
"default_timezone": "",
"match_shifts_by": ""
}
},
"sort": {
"field": "",
"order": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/labor/shifts/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/shifts/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/labor/shifts/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
employee_ids: [],
end: {
end_at: '',
start_at: ''
},
location_ids: [],
start: {},
status: '',
team_member_ids: [],
workday: {
date_range: {
end_date: '',
start_date: ''
},
default_timezone: '',
match_shifts_by: ''
}
},
sort: {
field: '',
order: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/labor/shifts/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/shifts/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {
employee_ids: [],
end: {end_at: '', start_at: ''},
location_ids: [],
start: {},
status: '',
team_member_ids: [],
workday: {
date_range: {end_date: '', start_date: ''},
default_timezone: '',
match_shifts_by: ''
}
},
sort: {field: '', order: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/shifts/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"employee_ids":[],"end":{"end_at":"","start_at":""},"location_ids":[],"start":{},"status":"","team_member_ids":[],"workday":{"date_range":{"end_date":"","start_date":""},"default_timezone":"","match_shifts_by":""}},"sort":{"field":"","order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/shifts/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "employee_ids": [],\n "end": {\n "end_at": "",\n "start_at": ""\n },\n "location_ids": [],\n "start": {},\n "status": "",\n "team_member_ids": [],\n "workday": {\n "date_range": {\n "end_date": "",\n "start_date": ""\n },\n "default_timezone": "",\n "match_shifts_by": ""\n }\n },\n "sort": {\n "field": "",\n "order": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/shifts/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
employee_ids: [],
end: {end_at: '', start_at: ''},
location_ids: [],
start: {},
status: '',
team_member_ids: [],
workday: {
date_range: {end_date: '', start_date: ''},
default_timezone: '',
match_shifts_by: ''
}
},
sort: {field: '', order: ''}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/shifts/search',
headers: {'content-type': 'application/json'},
body: {
cursor: '',
limit: 0,
query: {
filter: {
employee_ids: [],
end: {end_at: '', start_at: ''},
location_ids: [],
start: {},
status: '',
team_member_ids: [],
workday: {
date_range: {end_date: '', start_date: ''},
default_timezone: '',
match_shifts_by: ''
}
},
sort: {field: '', order: ''}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/labor/shifts/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
filter: {
employee_ids: [],
end: {
end_at: '',
start_at: ''
},
location_ids: [],
start: {},
status: '',
team_member_ids: [],
workday: {
date_range: {
end_date: '',
start_date: ''
},
default_timezone: '',
match_shifts_by: ''
}
},
sort: {
field: '',
order: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/labor/shifts/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {
employee_ids: [],
end: {end_at: '', start_at: ''},
location_ids: [],
start: {},
status: '',
team_member_ids: [],
workday: {
date_range: {end_date: '', start_date: ''},
default_timezone: '',
match_shifts_by: ''
}
},
sort: {field: '', order: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/shifts/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"employee_ids":[],"end":{"end_at":"","start_at":""},"location_ids":[],"start":{},"status":"","team_member_ids":[],"workday":{"date_range":{"end_date":"","start_date":""},"default_timezone":"","match_shifts_by":""}},"sort":{"field":"","order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"filter": @{ @"employee_ids": @[ ], @"end": @{ @"end_at": @"", @"start_at": @"" }, @"location_ids": @[ ], @"start": @{ }, @"status": @"", @"team_member_ids": @[ ], @"workday": @{ @"date_range": @{ @"end_date": @"", @"start_date": @"" }, @"default_timezone": @"", @"match_shifts_by": @"" } }, @"sort": @{ @"field": @"", @"order": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/shifts/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/shifts/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/shifts/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'employee_ids' => [
],
'end' => [
'end_at' => '',
'start_at' => ''
],
'location_ids' => [
],
'start' => [
],
'status' => '',
'team_member_ids' => [
],
'workday' => [
'date_range' => [
'end_date' => '',
'start_date' => ''
],
'default_timezone' => '',
'match_shifts_by' => ''
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/labor/shifts/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"employee_ids": [],
"end": {
"end_at": "",
"start_at": ""
},
"location_ids": [],
"start": {},
"status": "",
"team_member_ids": [],
"workday": {
"date_range": {
"end_date": "",
"start_date": ""
},
"default_timezone": "",
"match_shifts_by": ""
}
},
"sort": {
"field": "",
"order": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/shifts/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'employee_ids' => [
],
'end' => [
'end_at' => '',
'start_at' => ''
],
'location_ids' => [
],
'start' => [
],
'status' => '',
'team_member_ids' => [
],
'workday' => [
'date_range' => [
'end_date' => '',
'start_date' => ''
],
'default_timezone' => '',
'match_shifts_by' => ''
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'employee_ids' => [
],
'end' => [
'end_at' => '',
'start_at' => ''
],
'location_ids' => [
],
'start' => [
],
'status' => '',
'team_member_ids' => [
],
'workday' => [
'date_range' => [
'end_date' => '',
'start_date' => ''
],
'default_timezone' => '',
'match_shifts_by' => ''
]
],
'sort' => [
'field' => '',
'order' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/labor/shifts/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/shifts/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"employee_ids": [],
"end": {
"end_at": "",
"start_at": ""
},
"location_ids": [],
"start": {},
"status": "",
"team_member_ids": [],
"workday": {
"date_range": {
"end_date": "",
"start_date": ""
},
"default_timezone": "",
"match_shifts_by": ""
}
},
"sort": {
"field": "",
"order": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/shifts/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"employee_ids": [],
"end": {
"end_at": "",
"start_at": ""
},
"location_ids": [],
"start": {},
"status": "",
"team_member_ids": [],
"workday": {
"date_range": {
"end_date": "",
"start_date": ""
},
"default_timezone": "",
"match_shifts_by": ""
}
},
"sort": {
"field": "",
"order": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/labor/shifts/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/shifts/search"
payload = {
"cursor": "",
"limit": 0,
"query": {
"filter": {
"employee_ids": [],
"end": {
"end_at": "",
"start_at": ""
},
"location_ids": [],
"start": {},
"status": "",
"team_member_ids": [],
"workday": {
"date_range": {
"end_date": "",
"start_date": ""
},
"default_timezone": "",
"match_shifts_by": ""
}
},
"sort": {
"field": "",
"order": ""
}
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/shifts/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/shifts/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/labor/shifts/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"employee_ids\": [],\n \"end\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"location_ids\": [],\n \"start\": {},\n \"status\": \"\",\n \"team_member_ids\": [],\n \"workday\": {\n \"date_range\": {\n \"end_date\": \"\",\n \"start_date\": \"\"\n },\n \"default_timezone\": \"\",\n \"match_shifts_by\": \"\"\n }\n },\n \"sort\": {\n \"field\": \"\",\n \"order\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/shifts/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({
"filter": json!({
"employee_ids": (),
"end": json!({
"end_at": "",
"start_at": ""
}),
"location_ids": (),
"start": json!({}),
"status": "",
"team_member_ids": (),
"workday": json!({
"date_range": json!({
"end_date": "",
"start_date": ""
}),
"default_timezone": "",
"match_shifts_by": ""
})
}),
"sort": json!({
"field": "",
"order": ""
})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/labor/shifts/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"employee_ids": [],
"end": {
"end_at": "",
"start_at": ""
},
"location_ids": [],
"start": {},
"status": "",
"team_member_ids": [],
"workday": {
"date_range": {
"end_date": "",
"start_date": ""
},
"default_timezone": "",
"match_shifts_by": ""
}
},
"sort": {
"field": "",
"order": ""
}
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"employee_ids": [],
"end": {
"end_at": "",
"start_at": ""
},
"location_ids": [],
"start": {},
"status": "",
"team_member_ids": [],
"workday": {
"date_range": {
"end_date": "",
"start_date": ""
},
"default_timezone": "",
"match_shifts_by": ""
}
},
"sort": {
"field": "",
"order": ""
}
}
}' | \
http POST {{baseUrl}}/v2/labor/shifts/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "employee_ids": [],\n "end": {\n "end_at": "",\n "start_at": ""\n },\n "location_ids": [],\n "start": {},\n "status": "",\n "team_member_ids": [],\n "workday": {\n "date_range": {\n "end_date": "",\n "start_date": ""\n },\n "default_timezone": "",\n "match_shifts_by": ""\n }\n },\n "sort": {\n "field": "",\n "order": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/labor/shifts/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": [
"filter": [
"employee_ids": [],
"end": [
"end_at": "",
"start_at": ""
],
"location_ids": [],
"start": [],
"status": "",
"team_member_ids": [],
"workday": [
"date_range": [
"end_date": "",
"start_date": ""
],
"default_timezone": "",
"match_shifts_by": ""
]
],
"sort": [
"field": "",
"order": ""
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/shifts/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"shifts": [
{
"breaks": [
{
"break_type_id": "REGS1EQR1TPZ5",
"end_at": "2019-01-21T06:11:00-05:00",
"expected_duration": "PT10M",
"id": "SJW7X6AKEJQ65",
"is_paid": true,
"name": "Tea Break",
"start_at": "2019-01-21T06:11:00-05:00"
}
],
"created_at": "2019-01-24T01:12:03Z",
"employee_id": "ormj0jJJZ5OZIzxrZYJI",
"end_at": "2019-01-21T13:11:00-05:00",
"id": "X714F3HA6D1PT",
"location_id": "PAA1RJZZKXBFG",
"start_at": "2019-01-21T03:11:00-05:00",
"status": "CLOSED",
"team_member_id": "ormj0jJJZ5OZIzxrZYJI",
"timezone": "America/New_York",
"updated_at": "2019-02-07T22:21:08Z",
"version": 6,
"wage": {
"hourly_rate": {
"amount": 1100,
"currency": "USD"
},
"title": "Barista"
}
},
{
"breaks": [
{
"break_type_id": "WQX00VR99F53J",
"end_at": "2019-01-23T14:40:00-05:00",
"expected_duration": "PT10M",
"id": "BKS6VR7WR748A",
"is_paid": true,
"name": "Tea Break",
"start_at": "2019-01-23T14:30:00-05:00"
},
{
"break_type_id": "P6Q468ZFRN1AC",
"end_at": "2019-01-22T12:44:00-05:00",
"expected_duration": "PT15M",
"id": "BQFEZSHFZSC51",
"is_paid": false,
"name": "Coffee Break",
"start_at": "2019-01-22T12:30:00-05:00"
}
],
"created_at": "2019-01-23T23:32:45Z",
"employee_id": "33fJchumvVdJwxV0H6L9",
"end_at": "2019-01-22T13:02:00-05:00",
"id": "GDHYBZYWK0P2V",
"location_id": "PAA1RJZZKXBFG",
"start_at": "2019-01-22T12:02:00-05:00",
"status": "CLOSED",
"team_member_id": "33fJchumvVdJwxV0H6L9",
"timezone": "America/New_York",
"updated_at": "2019-01-24T00:56:25Z",
"version": 16,
"wage": {
"hourly_rate": {
"amount": 1600,
"currency": "USD"
},
"title": "Cook"
}
}
]
}
PUT
UpdateBreakType
{{baseUrl}}/v2/labor/break-types/:id
QUERY PARAMS
id
BODY json
{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/break-types/:id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/labor/break-types/:id" {:content-type :json
:form-params {:break_type {:break_name ""
:created_at ""
:expected_duration ""
:id ""
:is_paid false
:location_id ""
:updated_at ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/labor/break-types/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/labor/break-types/:id"),
Content = new StringContent("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/break-types/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/break-types/:id"
payload := strings.NewReader("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/labor/break-types/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 196
{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/labor/break-types/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/break-types/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/labor/break-types/:id")
.header("content-type", "application/json")
.body("{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/labor/break-types/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/break-types/:id',
headers: {'content-type': 'application/json'},
data: {
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/break-types/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"break_type":{"break_name":"","created_at":"","expected_duration":"","id":"","is_paid":false,"location_id":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/break-types/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "break_type": {\n "break_name": "",\n "created_at": "",\n "expected_duration": "",\n "id": "",\n "is_paid": false,\n "location_id": "",\n "updated_at": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/break-types/:id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/break-types/:id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/break-types/:id',
headers: {'content-type': 'application/json'},
body: {
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/labor/break-types/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/break-types/:id',
headers: {'content-type': 'application/json'},
data: {
break_type: {
break_name: '',
created_at: '',
expected_duration: '',
id: '',
is_paid: false,
location_id: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/break-types/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"break_type":{"break_name":"","created_at":"","expected_duration":"","id":"","is_paid":false,"location_id":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"break_type": @{ @"break_name": @"", @"created_at": @"", @"expected_duration": @"", @"id": @"", @"is_paid": @NO, @"location_id": @"", @"updated_at": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/break-types/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/break-types/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/break-types/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'break_type' => [
'break_name' => '',
'created_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'location_id' => '',
'updated_at' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/labor/break-types/:id', [
'body' => '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/break-types/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'break_type' => [
'break_name' => '',
'created_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'location_id' => '',
'updated_at' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'break_type' => [
'break_name' => '',
'created_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'location_id' => '',
'updated_at' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/labor/break-types/:id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/break-types/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/break-types/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/labor/break-types/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/break-types/:id"
payload = { "break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": False,
"location_id": "",
"updated_at": "",
"version": 0
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/break-types/:id"
payload <- "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/break-types/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/labor/break-types/:id') do |req|
req.body = "{\n \"break_type\": {\n \"break_name\": \"\",\n \"created_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"location_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/break-types/:id";
let payload = json!({"break_type": json!({
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/labor/break-types/:id \
--header 'content-type: application/json' \
--data '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
}
}'
echo '{
"break_type": {
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
}
}' | \
http PUT {{baseUrl}}/v2/labor/break-types/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "break_type": {\n "break_name": "",\n "created_at": "",\n "expected_duration": "",\n "id": "",\n "is_paid": false,\n "location_id": "",\n "updated_at": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/labor/break-types/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["break_type": [
"break_name": "",
"created_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"location_id": "",
"updated_at": "",
"version": 0
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/break-types/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"break_type": {
"break_name": "Lunch",
"created_at": "2018-06-12T20:19:12Z",
"expected_duration": "PT50M",
"id": "Q6JSJS6D4DBCH",
"is_paid": true,
"location_id": "26M7H24AZ9N6R",
"updated_at": "2019-02-26T23:12:59Z",
"version": 2
}
}
PUT
UpdateShift
{{baseUrl}}/v2/labor/shifts/:id
QUERY PARAMS
id
BODY json
{
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/shifts/:id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/labor/shifts/:id" {:content-type :json
:form-params {:shift {:breaks [{:break_type_id ""
:end_at ""
:expected_duration ""
:id ""
:is_paid false
:name ""
:start_at ""}]
:created_at ""
:employee_id ""
:end_at ""
:id ""
:location_id ""
:start_at ""
:status ""
:team_member_id ""
:timezone ""
:updated_at ""
:version 0
:wage {:hourly_rate {:amount 0
:currency ""}
:title ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/labor/shifts/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/labor/shifts/:id"),
Content = new StringContent("{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/shifts/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/shifts/:id"
payload := strings.NewReader("{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/labor/shifts/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 568
{
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/labor/shifts/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/shifts/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/labor/shifts/:id")
.header("content-type", "application/json")
.body("{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {
hourly_rate: {
amount: 0,
currency: ''
},
title: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/labor/shifts/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/shifts/:id',
headers: {'content-type': 'application/json'},
data: {
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {hourly_rate: {amount: 0, currency: ''}, title: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/shifts/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"shift":{"breaks":[{"break_type_id":"","end_at":"","expected_duration":"","id":"","is_paid":false,"name":"","start_at":""}],"created_at":"","employee_id":"","end_at":"","id":"","location_id":"","start_at":"","status":"","team_member_id":"","timezone":"","updated_at":"","version":0,"wage":{"hourly_rate":{"amount":0,"currency":""},"title":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/shifts/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "shift": {\n "breaks": [\n {\n "break_type_id": "",\n "end_at": "",\n "expected_duration": "",\n "id": "",\n "is_paid": false,\n "name": "",\n "start_at": ""\n }\n ],\n "created_at": "",\n "employee_id": "",\n "end_at": "",\n "id": "",\n "location_id": "",\n "start_at": "",\n "status": "",\n "team_member_id": "",\n "timezone": "",\n "updated_at": "",\n "version": 0,\n "wage": {\n "hourly_rate": {\n "amount": 0,\n "currency": ""\n },\n "title": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/shifts/:id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/shifts/:id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {hourly_rate: {amount: 0, currency: ''}, title: ''}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/shifts/:id',
headers: {'content-type': 'application/json'},
body: {
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {hourly_rate: {amount: 0, currency: ''}, title: ''}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/labor/shifts/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {
hourly_rate: {
amount: 0,
currency: ''
},
title: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/shifts/:id',
headers: {'content-type': 'application/json'},
data: {
shift: {
breaks: [
{
break_type_id: '',
end_at: '',
expected_duration: '',
id: '',
is_paid: false,
name: '',
start_at: ''
}
],
created_at: '',
employee_id: '',
end_at: '',
id: '',
location_id: '',
start_at: '',
status: '',
team_member_id: '',
timezone: '',
updated_at: '',
version: 0,
wage: {hourly_rate: {amount: 0, currency: ''}, title: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/shifts/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"shift":{"breaks":[{"break_type_id":"","end_at":"","expected_duration":"","id":"","is_paid":false,"name":"","start_at":""}],"created_at":"","employee_id":"","end_at":"","id":"","location_id":"","start_at":"","status":"","team_member_id":"","timezone":"","updated_at":"","version":0,"wage":{"hourly_rate":{"amount":0,"currency":""},"title":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"shift": @{ @"breaks": @[ @{ @"break_type_id": @"", @"end_at": @"", @"expected_duration": @"", @"id": @"", @"is_paid": @NO, @"name": @"", @"start_at": @"" } ], @"created_at": @"", @"employee_id": @"", @"end_at": @"", @"id": @"", @"location_id": @"", @"start_at": @"", @"status": @"", @"team_member_id": @"", @"timezone": @"", @"updated_at": @"", @"version": @0, @"wage": @{ @"hourly_rate": @{ @"amount": @0, @"currency": @"" }, @"title": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/shifts/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/shifts/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/shifts/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'shift' => [
'breaks' => [
[
'break_type_id' => '',
'end_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'name' => '',
'start_at' => ''
]
],
'created_at' => '',
'employee_id' => '',
'end_at' => '',
'id' => '',
'location_id' => '',
'start_at' => '',
'status' => '',
'team_member_id' => '',
'timezone' => '',
'updated_at' => '',
'version' => 0,
'wage' => [
'hourly_rate' => [
'amount' => 0,
'currency' => ''
],
'title' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/labor/shifts/:id', [
'body' => '{
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/shifts/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'shift' => [
'breaks' => [
[
'break_type_id' => '',
'end_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'name' => '',
'start_at' => ''
]
],
'created_at' => '',
'employee_id' => '',
'end_at' => '',
'id' => '',
'location_id' => '',
'start_at' => '',
'status' => '',
'team_member_id' => '',
'timezone' => '',
'updated_at' => '',
'version' => 0,
'wage' => [
'hourly_rate' => [
'amount' => 0,
'currency' => ''
],
'title' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'shift' => [
'breaks' => [
[
'break_type_id' => '',
'end_at' => '',
'expected_duration' => '',
'id' => '',
'is_paid' => null,
'name' => '',
'start_at' => ''
]
],
'created_at' => '',
'employee_id' => '',
'end_at' => '',
'id' => '',
'location_id' => '',
'start_at' => '',
'status' => '',
'team_member_id' => '',
'timezone' => '',
'updated_at' => '',
'version' => 0,
'wage' => [
'hourly_rate' => [
'amount' => 0,
'currency' => ''
],
'title' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/labor/shifts/:id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/shifts/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/shifts/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/labor/shifts/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/shifts/:id"
payload = { "shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": False,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/shifts/:id"
payload <- "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/shifts/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/labor/shifts/:id') do |req|
req.body = "{\n \"shift\": {\n \"breaks\": [\n {\n \"break_type_id\": \"\",\n \"end_at\": \"\",\n \"expected_duration\": \"\",\n \"id\": \"\",\n \"is_paid\": false,\n \"name\": \"\",\n \"start_at\": \"\"\n }\n ],\n \"created_at\": \"\",\n \"employee_id\": \"\",\n \"end_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"start_at\": \"\",\n \"status\": \"\",\n \"team_member_id\": \"\",\n \"timezone\": \"\",\n \"updated_at\": \"\",\n \"version\": 0,\n \"wage\": {\n \"hourly_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"title\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/shifts/:id";
let payload = json!({"shift": json!({
"breaks": (
json!({
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
})
),
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": json!({
"hourly_rate": json!({
"amount": 0,
"currency": ""
}),
"title": ""
})
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/labor/shifts/:id \
--header 'content-type: application/json' \
--data '{
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}'
echo '{
"shift": {
"breaks": [
{
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
}
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": {
"hourly_rate": {
"amount": 0,
"currency": ""
},
"title": ""
}
}
}' | \
http PUT {{baseUrl}}/v2/labor/shifts/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "shift": {\n "breaks": [\n {\n "break_type_id": "",\n "end_at": "",\n "expected_duration": "",\n "id": "",\n "is_paid": false,\n "name": "",\n "start_at": ""\n }\n ],\n "created_at": "",\n "employee_id": "",\n "end_at": "",\n "id": "",\n "location_id": "",\n "start_at": "",\n "status": "",\n "team_member_id": "",\n "timezone": "",\n "updated_at": "",\n "version": 0,\n "wage": {\n "hourly_rate": {\n "amount": 0,\n "currency": ""\n },\n "title": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/labor/shifts/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["shift": [
"breaks": [
[
"break_type_id": "",
"end_at": "",
"expected_duration": "",
"id": "",
"is_paid": false,
"name": "",
"start_at": ""
]
],
"created_at": "",
"employee_id": "",
"end_at": "",
"id": "",
"location_id": "",
"start_at": "",
"status": "",
"team_member_id": "",
"timezone": "",
"updated_at": "",
"version": 0,
"wage": [
"hourly_rate": [
"amount": 0,
"currency": ""
],
"title": ""
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/shifts/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"shift": {
"breaks": [
{
"break_type_id": "REGS1EQR1TPZ5",
"end_at": "2019-01-25T06:16:00-05:00",
"expected_duration": "PT5M",
"id": "X7GAQYVVRRG6P",
"is_paid": true,
"name": "Tea Break",
"start_at": "2019-01-25T06:11:00-05:00"
}
],
"created_at": "2019-02-28T00:39:02Z",
"employee_id": "ormj0jJJZ5OZIzxrZYJI",
"end_at": "2019-01-25T13:11:00-05:00",
"id": "K0YH4CV5462JB",
"location_id": "PAA1RJZZKXBFG",
"start_at": "2019-01-25T03:11:00-05:00",
"status": "CLOSED",
"team_member_id": "ormj0jJJZ5OZIzxrZYJI",
"timezone": "America/New_York",
"updated_at": "2019-02-28T00:42:41Z",
"version": 2,
"wage": {
"hourly_rate": {
"amount": 1500,
"currency": "USD"
},
"title": "Bartender"
}
}
}
PUT
UpdateWorkweekConfig
{{baseUrl}}/v2/labor/workweek-configs/:id
QUERY PARAMS
id
BODY json
{
"workweek_config": {
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/labor/workweek-configs/:id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/labor/workweek-configs/:id" {:content-type :json
:form-params {:workweek_config {:created_at ""
:id ""
:start_of_day_local_time ""
:start_of_week ""
:updated_at ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/labor/workweek-configs/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/labor/workweek-configs/:id"),
Content = new StringContent("{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/labor/workweek-configs/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/labor/workweek-configs/:id"
payload := strings.NewReader("{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/labor/workweek-configs/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 165
{
"workweek_config": {
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/labor/workweek-configs/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/labor/workweek-configs/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/labor/workweek-configs/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/labor/workweek-configs/:id")
.header("content-type", "application/json")
.body("{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
workweek_config: {
created_at: '',
id: '',
start_of_day_local_time: '',
start_of_week: '',
updated_at: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/labor/workweek-configs/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/workweek-configs/:id',
headers: {'content-type': 'application/json'},
data: {
workweek_config: {
created_at: '',
id: '',
start_of_day_local_time: '',
start_of_week: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/labor/workweek-configs/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"workweek_config":{"created_at":"","id":"","start_of_day_local_time":"","start_of_week":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/labor/workweek-configs/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "workweek_config": {\n "created_at": "",\n "id": "",\n "start_of_day_local_time": "",\n "start_of_week": "",\n "updated_at": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/labor/workweek-configs/:id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/labor/workweek-configs/:id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
workweek_config: {
created_at: '',
id: '',
start_of_day_local_time: '',
start_of_week: '',
updated_at: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/workweek-configs/:id',
headers: {'content-type': 'application/json'},
body: {
workweek_config: {
created_at: '',
id: '',
start_of_day_local_time: '',
start_of_week: '',
updated_at: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/labor/workweek-configs/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
workweek_config: {
created_at: '',
id: '',
start_of_day_local_time: '',
start_of_week: '',
updated_at: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/labor/workweek-configs/:id',
headers: {'content-type': 'application/json'},
data: {
workweek_config: {
created_at: '',
id: '',
start_of_day_local_time: '',
start_of_week: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/labor/workweek-configs/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"workweek_config":{"created_at":"","id":"","start_of_day_local_time":"","start_of_week":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"workweek_config": @{ @"created_at": @"", @"id": @"", @"start_of_day_local_time": @"", @"start_of_week": @"", @"updated_at": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/labor/workweek-configs/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/labor/workweek-configs/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/labor/workweek-configs/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'workweek_config' => [
'created_at' => '',
'id' => '',
'start_of_day_local_time' => '',
'start_of_week' => '',
'updated_at' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/labor/workweek-configs/:id', [
'body' => '{
"workweek_config": {
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/labor/workweek-configs/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'workweek_config' => [
'created_at' => '',
'id' => '',
'start_of_day_local_time' => '',
'start_of_week' => '',
'updated_at' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'workweek_config' => [
'created_at' => '',
'id' => '',
'start_of_day_local_time' => '',
'start_of_week' => '',
'updated_at' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/labor/workweek-configs/:id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/labor/workweek-configs/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"workweek_config": {
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/labor/workweek-configs/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"workweek_config": {
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/labor/workweek-configs/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/labor/workweek-configs/:id"
payload = { "workweek_config": {
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/labor/workweek-configs/:id"
payload <- "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/labor/workweek-configs/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/labor/workweek-configs/:id') do |req|
req.body = "{\n \"workweek_config\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"start_of_day_local_time\": \"\",\n \"start_of_week\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/labor/workweek-configs/:id";
let payload = json!({"workweek_config": json!({
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/labor/workweek-configs/:id \
--header 'content-type: application/json' \
--data '{
"workweek_config": {
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
}
}'
echo '{
"workweek_config": {
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
}
}' | \
http PUT {{baseUrl}}/v2/labor/workweek-configs/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "workweek_config": {\n "created_at": "",\n "id": "",\n "start_of_day_local_time": "",\n "start_of_week": "",\n "updated_at": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/labor/workweek-configs/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["workweek_config": [
"created_at": "",
"id": "",
"start_of_day_local_time": "",
"start_of_week": "",
"updated_at": "",
"version": 0
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/labor/workweek-configs/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"workweek_config": {
"created_at": "2016-02-04T00:58:24Z",
"id": "FY4VCAQN700GM",
"start_of_day_local_time": "10:00",
"start_of_week": "MON",
"updated_at": "2019-02-28T01:04:35Z",
"version": 11
}
}
POST
CreateLocation
{{baseUrl}}/v2/locations
BODY json
{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/locations" {:content-type :json
:form-params {:location {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:business_email ""
:business_hours {:periods [{:day_of_week ""
:end_local_time ""
:start_local_time ""}]}
:business_name ""
:capabilities []
:coordinates {:latitude ""
:longitude ""}
:country ""
:created_at ""
:currency ""
:description ""
:facebook_url ""
:full_format_logo_url ""
:id ""
:instagram_username ""
:language_code ""
:logo_url ""
:mcc ""
:merchant_id ""
:name ""
:phone_number ""
:pos_background_url ""
:status ""
:tax_ids {:eu_vat ""
:fr_naf ""
:fr_siret ""}
:timezone ""
:twitter_username ""
:type ""
:website_url ""}}})
require "http/client"
url = "{{baseUrl}}/v2/locations"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/locations"),
Content = new StringContent("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations"
payload := strings.NewReader("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/locations HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1330
{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/locations")
.setHeader("content-type", "application/json")
.setBody("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/locations")
.header("content-type", "application/json")
.body("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {
periods: [
{
day_of_week: '',
end_local_time: '',
start_local_time: ''
}
]
},
business_name: '',
capabilities: [],
coordinates: {
latitude: '',
longitude: ''
},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {
eu_vat: '',
fr_naf: '',
fr_siret: ''
},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/locations');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations',
headers: {'content-type': 'application/json'},
data: {
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {periods: [{day_of_week: '', end_local_time: '', start_local_time: ''}]},
business_name: '',
capabilities: [],
coordinates: {latitude: '', longitude: ''},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {eu_vat: '', fr_naf: '', fr_siret: ''},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"location":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"business_email":"","business_hours":{"periods":[{"day_of_week":"","end_local_time":"","start_local_time":""}]},"business_name":"","capabilities":[],"coordinates":{"latitude":"","longitude":""},"country":"","created_at":"","currency":"","description":"","facebook_url":"","full_format_logo_url":"","id":"","instagram_username":"","language_code":"","logo_url":"","mcc":"","merchant_id":"","name":"","phone_number":"","pos_background_url":"","status":"","tax_ids":{"eu_vat":"","fr_naf":"","fr_siret":""},"timezone":"","twitter_username":"","type":"","website_url":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "location": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "business_email": "",\n "business_hours": {\n "periods": [\n {\n "day_of_week": "",\n "end_local_time": "",\n "start_local_time": ""\n }\n ]\n },\n "business_name": "",\n "capabilities": [],\n "coordinates": {\n "latitude": "",\n "longitude": ""\n },\n "country": "",\n "created_at": "",\n "currency": "",\n "description": "",\n "facebook_url": "",\n "full_format_logo_url": "",\n "id": "",\n "instagram_username": "",\n "language_code": "",\n "logo_url": "",\n "mcc": "",\n "merchant_id": "",\n "name": "",\n "phone_number": "",\n "pos_background_url": "",\n "status": "",\n "tax_ids": {\n "eu_vat": "",\n "fr_naf": "",\n "fr_siret": ""\n },\n "timezone": "",\n "twitter_username": "",\n "type": "",\n "website_url": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {periods: [{day_of_week: '', end_local_time: '', start_local_time: ''}]},
business_name: '',
capabilities: [],
coordinates: {latitude: '', longitude: ''},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {eu_vat: '', fr_naf: '', fr_siret: ''},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations',
headers: {'content-type': 'application/json'},
body: {
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {periods: [{day_of_week: '', end_local_time: '', start_local_time: ''}]},
business_name: '',
capabilities: [],
coordinates: {latitude: '', longitude: ''},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {eu_vat: '', fr_naf: '', fr_siret: ''},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/locations');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {
periods: [
{
day_of_week: '',
end_local_time: '',
start_local_time: ''
}
]
},
business_name: '',
capabilities: [],
coordinates: {
latitude: '',
longitude: ''
},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {
eu_vat: '',
fr_naf: '',
fr_siret: ''
},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations',
headers: {'content-type': 'application/json'},
data: {
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {periods: [{day_of_week: '', end_local_time: '', start_local_time: ''}]},
business_name: '',
capabilities: [],
coordinates: {latitude: '', longitude: ''},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {eu_vat: '', fr_naf: '', fr_siret: ''},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"location":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"business_email":"","business_hours":{"periods":[{"day_of_week":"","end_local_time":"","start_local_time":""}]},"business_name":"","capabilities":[],"coordinates":{"latitude":"","longitude":""},"country":"","created_at":"","currency":"","description":"","facebook_url":"","full_format_logo_url":"","id":"","instagram_username":"","language_code":"","logo_url":"","mcc":"","merchant_id":"","name":"","phone_number":"","pos_background_url":"","status":"","tax_ids":{"eu_vat":"","fr_naf":"","fr_siret":""},"timezone":"","twitter_username":"","type":"","website_url":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"location": @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"business_email": @"", @"business_hours": @{ @"periods": @[ @{ @"day_of_week": @"", @"end_local_time": @"", @"start_local_time": @"" } ] }, @"business_name": @"", @"capabilities": @[ ], @"coordinates": @{ @"latitude": @"", @"longitude": @"" }, @"country": @"", @"created_at": @"", @"currency": @"", @"description": @"", @"facebook_url": @"", @"full_format_logo_url": @"", @"id": @"", @"instagram_username": @"", @"language_code": @"", @"logo_url": @"", @"mcc": @"", @"merchant_id": @"", @"name": @"", @"phone_number": @"", @"pos_background_url": @"", @"status": @"", @"tax_ids": @{ @"eu_vat": @"", @"fr_naf": @"", @"fr_siret": @"" }, @"timezone": @"", @"twitter_username": @"", @"type": @"", @"website_url": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'business_email' => '',
'business_hours' => [
'periods' => [
[
'day_of_week' => '',
'end_local_time' => '',
'start_local_time' => ''
]
]
],
'business_name' => '',
'capabilities' => [
],
'coordinates' => [
'latitude' => '',
'longitude' => ''
],
'country' => '',
'created_at' => '',
'currency' => '',
'description' => '',
'facebook_url' => '',
'full_format_logo_url' => '',
'id' => '',
'instagram_username' => '',
'language_code' => '',
'logo_url' => '',
'mcc' => '',
'merchant_id' => '',
'name' => '',
'phone_number' => '',
'pos_background_url' => '',
'status' => '',
'tax_ids' => [
'eu_vat' => '',
'fr_naf' => '',
'fr_siret' => ''
],
'timezone' => '',
'twitter_username' => '',
'type' => '',
'website_url' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/locations', [
'body' => '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'location' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'business_email' => '',
'business_hours' => [
'periods' => [
[
'day_of_week' => '',
'end_local_time' => '',
'start_local_time' => ''
]
]
],
'business_name' => '',
'capabilities' => [
],
'coordinates' => [
'latitude' => '',
'longitude' => ''
],
'country' => '',
'created_at' => '',
'currency' => '',
'description' => '',
'facebook_url' => '',
'full_format_logo_url' => '',
'id' => '',
'instagram_username' => '',
'language_code' => '',
'logo_url' => '',
'mcc' => '',
'merchant_id' => '',
'name' => '',
'phone_number' => '',
'pos_background_url' => '',
'status' => '',
'tax_ids' => [
'eu_vat' => '',
'fr_naf' => '',
'fr_siret' => ''
],
'timezone' => '',
'twitter_username' => '',
'type' => '',
'website_url' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'location' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'business_email' => '',
'business_hours' => [
'periods' => [
[
'day_of_week' => '',
'end_local_time' => '',
'start_local_time' => ''
]
]
],
'business_name' => '',
'capabilities' => [
],
'coordinates' => [
'latitude' => '',
'longitude' => ''
],
'country' => '',
'created_at' => '',
'currency' => '',
'description' => '',
'facebook_url' => '',
'full_format_logo_url' => '',
'id' => '',
'instagram_username' => '',
'language_code' => '',
'logo_url' => '',
'mcc' => '',
'merchant_id' => '',
'name' => '',
'phone_number' => '',
'pos_background_url' => '',
'status' => '',
'tax_ids' => [
'eu_vat' => '',
'fr_naf' => '',
'fr_siret' => ''
],
'timezone' => '',
'twitter_username' => '',
'type' => '',
'website_url' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/locations');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/locations", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations"
payload = { "location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": { "periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
] },
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations"
payload <- "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/locations') do |req|
req.body = "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations";
let payload = json!({"location": json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"business_email": "",
"business_hours": json!({"periods": (
json!({
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
})
)}),
"business_name": "",
"capabilities": (),
"coordinates": json!({
"latitude": "",
"longitude": ""
}),
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": json!({
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
}),
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/locations \
--header 'content-type: application/json' \
--data '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}'
echo '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}' | \
http POST {{baseUrl}}/v2/locations \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "location": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "business_email": "",\n "business_hours": {\n "periods": [\n {\n "day_of_week": "",\n "end_local_time": "",\n "start_local_time": ""\n }\n ]\n },\n "business_name": "",\n "capabilities": [],\n "coordinates": {\n "latitude": "",\n "longitude": ""\n },\n "country": "",\n "created_at": "",\n "currency": "",\n "description": "",\n "facebook_url": "",\n "full_format_logo_url": "",\n "id": "",\n "instagram_username": "",\n "language_code": "",\n "logo_url": "",\n "mcc": "",\n "merchant_id": "",\n "name": "",\n "phone_number": "",\n "pos_background_url": "",\n "status": "",\n "tax_ids": {\n "eu_vat": "",\n "fr_naf": "",\n "fr_siret": ""\n },\n "timezone": "",\n "twitter_username": "",\n "type": "",\n "website_url": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/locations
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["location": [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"business_email": "",
"business_hours": ["periods": [
[
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
]
]],
"business_name": "",
"capabilities": [],
"coordinates": [
"latitude": "",
"longitude": ""
],
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": [
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
],
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"location": {
"address": {
"address_line_1": "1234 Peachtree St. NE",
"administrative_district_level_1": "GA",
"locality": "Atlanta",
"postal_code": "30309"
},
"capabilities": [
"CREDIT_CARD_PROCESSING"
],
"coordinates": {
"latitude": 33.788567,
"longitude": -84.466947
},
"country": "US",
"created_at": "2019-07-19T17:58:25Z",
"currency": "USD",
"description": "My new location.",
"id": "LOCATION_ID",
"instagram_username": "instagram",
"language_code": "en-US",
"mcc": "1234",
"merchant_id": "MERCHANT_ID",
"name": "New location name",
"status": "ACTIVE",
"twitter_username": "twitter",
"type": "PHYSICAL",
"website_url": "examplewebsite.com"
}
}
GET
ListLocations
{{baseUrl}}/v2/locations
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/locations")
require "http/client"
url = "{{baseUrl}}/v2/locations"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/locations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/locations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/locations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/locations")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/locations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/locations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/locations'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/locations');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/locations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/locations');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/locations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/locations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/locations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/locations
http GET {{baseUrl}}/v2/locations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/locations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"locations": [
{
"address": {
"address_line_1": "123 Main St",
"administrative_district_level_1": "CA",
"country": "US",
"locality": "San Francisco",
"postal_code": "94114"
},
"business_name": "Pumbaa's business name",
"capabilities": [
"CREDIT_CARD_PROCESSING"
],
"country": "US",
"created_at": "2016-09-19T17:33:12Z",
"currency": "USD",
"id": "18YC4JDH91E1H",
"language_code": "en-US",
"merchant_id": "3MYCJG5GVYQ8Q",
"name": "your location name",
"phone_number": "+1 650-354-7217",
"status": "ACTIVE",
"timezone": "America/Los_Angeles"
}
]
}
GET
RetrieveLocation
{{baseUrl}}/v2/locations/:location_id
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/locations/:location_id")
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/locations/:location_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/locations/:location_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/locations/:location_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/locations/:location_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/locations/:location_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/locations/:location_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/locations/:location_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/locations/:location_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/locations/:location_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/locations/:location_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/locations/:location_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/locations/:location_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/locations/:location_id
http GET {{baseUrl}}/v2/locations/:location_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/locations/:location_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"location": {
"address": {
"address_line_1": "123 Main St",
"administrative_district_level_1": "CA",
"country": "US",
"locality": "San Francisco",
"postal_code": "94114"
},
"business_name": "Jet Fuel Coffee",
"capabilities": [
"CREDIT_CARD_PROCESSING"
],
"country": "US",
"created_at": "2016-09-19T17:33:12Z",
"currency": "USD",
"id": "18YC4JDH91E1H",
"language_code": "en-US",
"merchant_id": "3MYCJG5GVYQ8Q",
"name": "Jet Fuel Coffee - Grant Park",
"phone_number": "+1 650-354-7217",
"status": "ACTIVE",
"timezone": "America/Los_Angeles"
}
}
PUT
UpdateLocation
{{baseUrl}}/v2/locations/:location_id
QUERY PARAMS
location_id
BODY json
{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/locations/:location_id" {:content-type :json
:form-params {:location {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:business_email ""
:business_hours {:periods [{:day_of_week ""
:end_local_time ""
:start_local_time ""}]}
:business_name ""
:capabilities []
:coordinates {:latitude ""
:longitude ""}
:country ""
:created_at ""
:currency ""
:description ""
:facebook_url ""
:full_format_logo_url ""
:id ""
:instagram_username ""
:language_code ""
:logo_url ""
:mcc ""
:merchant_id ""
:name ""
:phone_number ""
:pos_background_url ""
:status ""
:tax_ids {:eu_vat ""
:fr_naf ""
:fr_siret ""}
:timezone ""
:twitter_username ""
:type ""
:website_url ""}}})
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id"),
Content = new StringContent("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id"
payload := strings.NewReader("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/locations/:location_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1330
{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/locations/:location_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/locations/:location_id")
.header("content-type", "application/json")
.body("{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {
periods: [
{
day_of_week: '',
end_local_time: '',
start_local_time: ''
}
]
},
business_name: '',
capabilities: [],
coordinates: {
latitude: '',
longitude: ''
},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {
eu_vat: '',
fr_naf: '',
fr_siret: ''
},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/locations/:location_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/locations/:location_id',
headers: {'content-type': 'application/json'},
data: {
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {periods: [{day_of_week: '', end_local_time: '', start_local_time: ''}]},
business_name: '',
capabilities: [],
coordinates: {latitude: '', longitude: ''},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {eu_vat: '', fr_naf: '', fr_siret: ''},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"location":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"business_email":"","business_hours":{"periods":[{"day_of_week":"","end_local_time":"","start_local_time":""}]},"business_name":"","capabilities":[],"coordinates":{"latitude":"","longitude":""},"country":"","created_at":"","currency":"","description":"","facebook_url":"","full_format_logo_url":"","id":"","instagram_username":"","language_code":"","logo_url":"","mcc":"","merchant_id":"","name":"","phone_number":"","pos_background_url":"","status":"","tax_ids":{"eu_vat":"","fr_naf":"","fr_siret":""},"timezone":"","twitter_username":"","type":"","website_url":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "location": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "business_email": "",\n "business_hours": {\n "periods": [\n {\n "day_of_week": "",\n "end_local_time": "",\n "start_local_time": ""\n }\n ]\n },\n "business_name": "",\n "capabilities": [],\n "coordinates": {\n "latitude": "",\n "longitude": ""\n },\n "country": "",\n "created_at": "",\n "currency": "",\n "description": "",\n "facebook_url": "",\n "full_format_logo_url": "",\n "id": "",\n "instagram_username": "",\n "language_code": "",\n "logo_url": "",\n "mcc": "",\n "merchant_id": "",\n "name": "",\n "phone_number": "",\n "pos_background_url": "",\n "status": "",\n "tax_ids": {\n "eu_vat": "",\n "fr_naf": "",\n "fr_siret": ""\n },\n "timezone": "",\n "twitter_username": "",\n "type": "",\n "website_url": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {periods: [{day_of_week: '', end_local_time: '', start_local_time: ''}]},
business_name: '',
capabilities: [],
coordinates: {latitude: '', longitude: ''},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {eu_vat: '', fr_naf: '', fr_siret: ''},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/locations/:location_id',
headers: {'content-type': 'application/json'},
body: {
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {periods: [{day_of_week: '', end_local_time: '', start_local_time: ''}]},
business_name: '',
capabilities: [],
coordinates: {latitude: '', longitude: ''},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {eu_vat: '', fr_naf: '', fr_siret: ''},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/locations/:location_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {
periods: [
{
day_of_week: '',
end_local_time: '',
start_local_time: ''
}
]
},
business_name: '',
capabilities: [],
coordinates: {
latitude: '',
longitude: ''
},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {
eu_vat: '',
fr_naf: '',
fr_siret: ''
},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/locations/:location_id',
headers: {'content-type': 'application/json'},
data: {
location: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
business_email: '',
business_hours: {periods: [{day_of_week: '', end_local_time: '', start_local_time: ''}]},
business_name: '',
capabilities: [],
coordinates: {latitude: '', longitude: ''},
country: '',
created_at: '',
currency: '',
description: '',
facebook_url: '',
full_format_logo_url: '',
id: '',
instagram_username: '',
language_code: '',
logo_url: '',
mcc: '',
merchant_id: '',
name: '',
phone_number: '',
pos_background_url: '',
status: '',
tax_ids: {eu_vat: '', fr_naf: '', fr_siret: ''},
timezone: '',
twitter_username: '',
type: '',
website_url: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"location":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"business_email":"","business_hours":{"periods":[{"day_of_week":"","end_local_time":"","start_local_time":""}]},"business_name":"","capabilities":[],"coordinates":{"latitude":"","longitude":""},"country":"","created_at":"","currency":"","description":"","facebook_url":"","full_format_logo_url":"","id":"","instagram_username":"","language_code":"","logo_url":"","mcc":"","merchant_id":"","name":"","phone_number":"","pos_background_url":"","status":"","tax_ids":{"eu_vat":"","fr_naf":"","fr_siret":""},"timezone":"","twitter_username":"","type":"","website_url":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"location": @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"business_email": @"", @"business_hours": @{ @"periods": @[ @{ @"day_of_week": @"", @"end_local_time": @"", @"start_local_time": @"" } ] }, @"business_name": @"", @"capabilities": @[ ], @"coordinates": @{ @"latitude": @"", @"longitude": @"" }, @"country": @"", @"created_at": @"", @"currency": @"", @"description": @"", @"facebook_url": @"", @"full_format_logo_url": @"", @"id": @"", @"instagram_username": @"", @"language_code": @"", @"logo_url": @"", @"mcc": @"", @"merchant_id": @"", @"name": @"", @"phone_number": @"", @"pos_background_url": @"", @"status": @"", @"tax_ids": @{ @"eu_vat": @"", @"fr_naf": @"", @"fr_siret": @"" }, @"timezone": @"", @"twitter_username": @"", @"type": @"", @"website_url": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'location' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'business_email' => '',
'business_hours' => [
'periods' => [
[
'day_of_week' => '',
'end_local_time' => '',
'start_local_time' => ''
]
]
],
'business_name' => '',
'capabilities' => [
],
'coordinates' => [
'latitude' => '',
'longitude' => ''
],
'country' => '',
'created_at' => '',
'currency' => '',
'description' => '',
'facebook_url' => '',
'full_format_logo_url' => '',
'id' => '',
'instagram_username' => '',
'language_code' => '',
'logo_url' => '',
'mcc' => '',
'merchant_id' => '',
'name' => '',
'phone_number' => '',
'pos_background_url' => '',
'status' => '',
'tax_ids' => [
'eu_vat' => '',
'fr_naf' => '',
'fr_siret' => ''
],
'timezone' => '',
'twitter_username' => '',
'type' => '',
'website_url' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/locations/:location_id', [
'body' => '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'location' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'business_email' => '',
'business_hours' => [
'periods' => [
[
'day_of_week' => '',
'end_local_time' => '',
'start_local_time' => ''
]
]
],
'business_name' => '',
'capabilities' => [
],
'coordinates' => [
'latitude' => '',
'longitude' => ''
],
'country' => '',
'created_at' => '',
'currency' => '',
'description' => '',
'facebook_url' => '',
'full_format_logo_url' => '',
'id' => '',
'instagram_username' => '',
'language_code' => '',
'logo_url' => '',
'mcc' => '',
'merchant_id' => '',
'name' => '',
'phone_number' => '',
'pos_background_url' => '',
'status' => '',
'tax_ids' => [
'eu_vat' => '',
'fr_naf' => '',
'fr_siret' => ''
],
'timezone' => '',
'twitter_username' => '',
'type' => '',
'website_url' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'location' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'business_email' => '',
'business_hours' => [
'periods' => [
[
'day_of_week' => '',
'end_local_time' => '',
'start_local_time' => ''
]
]
],
'business_name' => '',
'capabilities' => [
],
'coordinates' => [
'latitude' => '',
'longitude' => ''
],
'country' => '',
'created_at' => '',
'currency' => '',
'description' => '',
'facebook_url' => '',
'full_format_logo_url' => '',
'id' => '',
'instagram_username' => '',
'language_code' => '',
'logo_url' => '',
'mcc' => '',
'merchant_id' => '',
'name' => '',
'phone_number' => '',
'pos_background_url' => '',
'status' => '',
'tax_ids' => [
'eu_vat' => '',
'fr_naf' => '',
'fr_siret' => ''
],
'timezone' => '',
'twitter_username' => '',
'type' => '',
'website_url' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/locations/:location_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/locations/:location_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id"
payload = { "location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": { "periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
] },
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id"
payload <- "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/locations/:location_id') do |req|
req.body = "{\n \"location\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"business_email\": \"\",\n \"business_hours\": {\n \"periods\": [\n {\n \"day_of_week\": \"\",\n \"end_local_time\": \"\",\n \"start_local_time\": \"\"\n }\n ]\n },\n \"business_name\": \"\",\n \"capabilities\": [],\n \"coordinates\": {\n \"latitude\": \"\",\n \"longitude\": \"\"\n },\n \"country\": \"\",\n \"created_at\": \"\",\n \"currency\": \"\",\n \"description\": \"\",\n \"facebook_url\": \"\",\n \"full_format_logo_url\": \"\",\n \"id\": \"\",\n \"instagram_username\": \"\",\n \"language_code\": \"\",\n \"logo_url\": \"\",\n \"mcc\": \"\",\n \"merchant_id\": \"\",\n \"name\": \"\",\n \"phone_number\": \"\",\n \"pos_background_url\": \"\",\n \"status\": \"\",\n \"tax_ids\": {\n \"eu_vat\": \"\",\n \"fr_naf\": \"\",\n \"fr_siret\": \"\"\n },\n \"timezone\": \"\",\n \"twitter_username\": \"\",\n \"type\": \"\",\n \"website_url\": \"\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id";
let payload = json!({"location": json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"business_email": "",
"business_hours": json!({"periods": (
json!({
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
})
)}),
"business_name": "",
"capabilities": (),
"coordinates": json!({
"latitude": "",
"longitude": ""
}),
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": json!({
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
}),
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/locations/:location_id \
--header 'content-type: application/json' \
--data '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}'
echo '{
"location": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"business_email": "",
"business_hours": {
"periods": [
{
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
}
]
},
"business_name": "",
"capabilities": [],
"coordinates": {
"latitude": "",
"longitude": ""
},
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": {
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
},
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
}
}' | \
http PUT {{baseUrl}}/v2/locations/:location_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "location": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "business_email": "",\n "business_hours": {\n "periods": [\n {\n "day_of_week": "",\n "end_local_time": "",\n "start_local_time": ""\n }\n ]\n },\n "business_name": "",\n "capabilities": [],\n "coordinates": {\n "latitude": "",\n "longitude": ""\n },\n "country": "",\n "created_at": "",\n "currency": "",\n "description": "",\n "facebook_url": "",\n "full_format_logo_url": "",\n "id": "",\n "instagram_username": "",\n "language_code": "",\n "logo_url": "",\n "mcc": "",\n "merchant_id": "",\n "name": "",\n "phone_number": "",\n "pos_background_url": "",\n "status": "",\n "tax_ids": {\n "eu_vat": "",\n "fr_naf": "",\n "fr_siret": ""\n },\n "timezone": "",\n "twitter_username": "",\n "type": "",\n "website_url": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/locations/:location_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["location": [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"business_email": "",
"business_hours": ["periods": [
[
"day_of_week": "",
"end_local_time": "",
"start_local_time": ""
]
]],
"business_name": "",
"capabilities": [],
"coordinates": [
"latitude": "",
"longitude": ""
],
"country": "",
"created_at": "",
"currency": "",
"description": "",
"facebook_url": "",
"full_format_logo_url": "",
"id": "",
"instagram_username": "",
"language_code": "",
"logo_url": "",
"mcc": "",
"merchant_id": "",
"name": "",
"phone_number": "",
"pos_background_url": "",
"status": "",
"tax_ids": [
"eu_vat": "",
"fr_naf": "",
"fr_siret": ""
],
"timezone": "",
"twitter_username": "",
"type": "",
"website_url": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"location": {
"address": {
"address_line_1": "1234 Peachtree St. NE",
"administrative_district_level_1": "GA",
"locality": "Atlanta",
"postal_code": "30309"
},
"business_email": "example@squareup.com",
"business_hours": {
"periods": [
{
"day_of_week": "MON",
"end_local_time": "17:00",
"start_local_time": "09:00"
}
]
},
"business_name": "Business Name",
"capabilities": [
"CREDIT_CARD_PROCESSING"
],
"coordinates": {
"latitude": 33.788567,
"longitude": -84.466947
},
"country": "US",
"created_at": "2019-07-19T17:58:25Z",
"currency": "USD",
"description": "Updated description",
"id": "LOCATION_ID",
"instagram_username": "instagram",
"language_code": "en-US",
"mcc": "1234",
"merchant_id": "MERCHANT_ID",
"name": "Updated nickname",
"phone_number": "5559211234",
"status": "ACTIVE",
"timezone": "America/New_York",
"twitter_username": "twitter",
"type": "MOBILE",
"website_url": "examplewebsite.com"
}
}
POST
AccumulateLoyaltyPoints
{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate
QUERY PARAMS
account_id
BODY json
{
"accumulate_points": {
"loyalty_program_id": "",
"order_id": "",
"points": 0
},
"idempotency_key": "",
"location_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate" {:content-type :json
:form-params {:accumulate_points {:loyalty_program_id ""
:order_id ""
:points 0}
:idempotency_key ""
:location_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate"),
Content = new StringContent("{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate"
payload := strings.NewReader("{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/accounts/:account_id/accumulate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 144
{
"accumulate_points": {
"loyalty_program_id": "",
"order_id": "",
"points": 0
},
"idempotency_key": "",
"location_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate")
.setHeader("content-type", "application/json")
.setBody("{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate")
.header("content-type", "application/json")
.body("{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
accumulate_points: {
loyalty_program_id: '',
order_id: '',
points: 0
},
idempotency_key: '',
location_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate',
headers: {'content-type': 'application/json'},
data: {
accumulate_points: {loyalty_program_id: '', order_id: '', points: 0},
idempotency_key: '',
location_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"accumulate_points":{"loyalty_program_id":"","order_id":"","points":0},"idempotency_key":"","location_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "accumulate_points": {\n "loyalty_program_id": "",\n "order_id": "",\n "points": 0\n },\n "idempotency_key": "",\n "location_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/accounts/:account_id/accumulate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
accumulate_points: {loyalty_program_id: '', order_id: '', points: 0},
idempotency_key: '',
location_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate',
headers: {'content-type': 'application/json'},
body: {
accumulate_points: {loyalty_program_id: '', order_id: '', points: 0},
idempotency_key: '',
location_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
accumulate_points: {
loyalty_program_id: '',
order_id: '',
points: 0
},
idempotency_key: '',
location_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate',
headers: {'content-type': 'application/json'},
data: {
accumulate_points: {loyalty_program_id: '', order_id: '', points: 0},
idempotency_key: '',
location_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"accumulate_points":{"loyalty_program_id":"","order_id":"","points":0},"idempotency_key":"","location_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"accumulate_points": @{ @"loyalty_program_id": @"", @"order_id": @"", @"points": @0 },
@"idempotency_key": @"",
@"location_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accumulate_points' => [
'loyalty_program_id' => '',
'order_id' => '',
'points' => 0
],
'idempotency_key' => '',
'location_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate', [
'body' => '{
"accumulate_points": {
"loyalty_program_id": "",
"order_id": "",
"points": 0
},
"idempotency_key": "",
"location_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'accumulate_points' => [
'loyalty_program_id' => '',
'order_id' => '',
'points' => 0
],
'idempotency_key' => '',
'location_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'accumulate_points' => [
'loyalty_program_id' => '',
'order_id' => '',
'points' => 0
],
'idempotency_key' => '',
'location_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"accumulate_points": {
"loyalty_program_id": "",
"order_id": "",
"points": 0
},
"idempotency_key": "",
"location_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"accumulate_points": {
"loyalty_program_id": "",
"order_id": "",
"points": 0
},
"idempotency_key": "",
"location_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/accounts/:account_id/accumulate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate"
payload = {
"accumulate_points": {
"loyalty_program_id": "",
"order_id": "",
"points": 0
},
"idempotency_key": "",
"location_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate"
payload <- "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/accounts/:account_id/accumulate') do |req|
req.body = "{\n \"accumulate_points\": {\n \"loyalty_program_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate";
let payload = json!({
"accumulate_points": json!({
"loyalty_program_id": "",
"order_id": "",
"points": 0
}),
"idempotency_key": "",
"location_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate \
--header 'content-type: application/json' \
--data '{
"accumulate_points": {
"loyalty_program_id": "",
"order_id": "",
"points": 0
},
"idempotency_key": "",
"location_id": ""
}'
echo '{
"accumulate_points": {
"loyalty_program_id": "",
"order_id": "",
"points": 0
},
"idempotency_key": "",
"location_id": ""
}' | \
http POST {{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "accumulate_points": {\n "loyalty_program_id": "",\n "order_id": "",\n "points": 0\n },\n "idempotency_key": "",\n "location_id": ""\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"accumulate_points": [
"loyalty_program_id": "",
"order_id": "",
"points": 0
],
"idempotency_key": "",
"location_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/accounts/:account_id/accumulate")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"event": {
"accumulate_points": {
"loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
"points": 6
},
"created_at": "2020-05-08T21:41:12Z",
"id": "ee46aafd-1af6-3695-a385-276e2ef0be26",
"location_id": "P034NEENMD09F",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"source": "LOYALTY_API",
"type": "ACCUMULATE_POINTS"
}
}
POST
AdjustLoyaltyPoints
{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust
QUERY PARAMS
account_id
BODY json
{
"adjust_points": {
"loyalty_program_id": "",
"points": 0,
"reason": ""
},
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust" {:content-type :json
:form-params {:adjust_points {:loyalty_program_id ""
:points 0
:reason ""}
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust"),
Content = new StringContent("{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust"
payload := strings.NewReader("{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/accounts/:account_id/adjust HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 117
{
"adjust_points": {
"loyalty_program_id": "",
"points": 0,
"reason": ""
},
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust")
.setHeader("content-type", "application/json")
.setBody("{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust")
.header("content-type", "application/json")
.body("{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
adjust_points: {
loyalty_program_id: '',
points: 0,
reason: ''
},
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust',
headers: {'content-type': 'application/json'},
data: {
adjust_points: {loyalty_program_id: '', points: 0, reason: ''},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"adjust_points":{"loyalty_program_id":"","points":0,"reason":""},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "adjust_points": {\n "loyalty_program_id": "",\n "points": 0,\n "reason": ""\n },\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/accounts/:account_id/adjust',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
adjust_points: {loyalty_program_id: '', points: 0, reason: ''},
idempotency_key: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust',
headers: {'content-type': 'application/json'},
body: {
adjust_points: {loyalty_program_id: '', points: 0, reason: ''},
idempotency_key: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
adjust_points: {
loyalty_program_id: '',
points: 0,
reason: ''
},
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust',
headers: {'content-type': 'application/json'},
data: {
adjust_points: {loyalty_program_id: '', points: 0, reason: ''},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"adjust_points":{"loyalty_program_id":"","points":0,"reason":""},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"adjust_points": @{ @"loyalty_program_id": @"", @"points": @0, @"reason": @"" },
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'adjust_points' => [
'loyalty_program_id' => '',
'points' => 0,
'reason' => ''
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust', [
'body' => '{
"adjust_points": {
"loyalty_program_id": "",
"points": 0,
"reason": ""
},
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'adjust_points' => [
'loyalty_program_id' => '',
'points' => 0,
'reason' => ''
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'adjust_points' => [
'loyalty_program_id' => '',
'points' => 0,
'reason' => ''
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"adjust_points": {
"loyalty_program_id": "",
"points": 0,
"reason": ""
},
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"adjust_points": {
"loyalty_program_id": "",
"points": 0,
"reason": ""
},
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/accounts/:account_id/adjust", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust"
payload = {
"adjust_points": {
"loyalty_program_id": "",
"points": 0,
"reason": ""
},
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust"
payload <- "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/accounts/:account_id/adjust') do |req|
req.body = "{\n \"adjust_points\": {\n \"loyalty_program_id\": \"\",\n \"points\": 0,\n \"reason\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust";
let payload = json!({
"adjust_points": json!({
"loyalty_program_id": "",
"points": 0,
"reason": ""
}),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/accounts/:account_id/adjust \
--header 'content-type: application/json' \
--data '{
"adjust_points": {
"loyalty_program_id": "",
"points": 0,
"reason": ""
},
"idempotency_key": ""
}'
echo '{
"adjust_points": {
"loyalty_program_id": "",
"points": 0,
"reason": ""
},
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/loyalty/accounts/:account_id/adjust \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "adjust_points": {\n "loyalty_program_id": "",\n "points": 0,\n "reason": ""\n },\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/accounts/:account_id/adjust
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"adjust_points": [
"loyalty_program_id": "",
"points": 0,
"reason": ""
],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/accounts/:account_id/adjust")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"event": {
"adjust_points": {
"loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"points": 10,
"reason": "Complimentary points"
},
"created_at": "2020-05-08T21:42:32Z",
"id": "613a6fca-8d67-39d0-bad2-3b4bc45c8637",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"source": "LOYALTY_API",
"type": "ADJUST_POINTS"
}
}
POST
CalculateLoyaltyPoints
{{baseUrl}}/v2/loyalty/programs/:program_id/calculate
QUERY PARAMS
program_id
BODY json
{
"order_id": "",
"transaction_amount_money": {
"amount": 0,
"currency": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate" {:content-type :json
:form-params {:order_id ""
:transaction_amount_money {:amount 0
:currency ""}}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/programs/:program_id/calculate"),
Content = new StringContent("{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/programs/:program_id/calculate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate"
payload := strings.NewReader("{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/programs/:program_id/calculate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 93
{
"order_id": "",
"transaction_amount_money": {
"amount": 0,
"currency": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate")
.setHeader("content-type", "application/json")
.setBody("{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/programs/:program_id/calculate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/programs/:program_id/calculate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/programs/:program_id/calculate")
.header("content-type", "application/json")
.body("{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
order_id: '',
transaction_amount_money: {
amount: 0,
currency: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate',
headers: {'content-type': 'application/json'},
data: {order_id: '', transaction_amount_money: {amount: 0, currency: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"order_id":"","transaction_amount_money":{"amount":0,"currency":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "order_id": "",\n "transaction_amount_money": {\n "amount": 0,\n "currency": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/programs/:program_id/calculate")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/programs/:program_id/calculate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({order_id: '', transaction_amount_money: {amount: 0, currency: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate',
headers: {'content-type': 'application/json'},
body: {order_id: '', transaction_amount_money: {amount: 0, currency: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
order_id: '',
transaction_amount_money: {
amount: 0,
currency: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate',
headers: {'content-type': 'application/json'},
data: {order_id: '', transaction_amount_money: {amount: 0, currency: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"order_id":"","transaction_amount_money":{"amount":0,"currency":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"order_id": @"",
@"transaction_amount_money": @{ @"amount": @0, @"currency": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/programs/:program_id/calculate"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/programs/:program_id/calculate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'order_id' => '',
'transaction_amount_money' => [
'amount' => 0,
'currency' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate', [
'body' => '{
"order_id": "",
"transaction_amount_money": {
"amount": 0,
"currency": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/programs/:program_id/calculate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'order_id' => '',
'transaction_amount_money' => [
'amount' => 0,
'currency' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'order_id' => '',
'transaction_amount_money' => [
'amount' => 0,
'currency' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/programs/:program_id/calculate');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"order_id": "",
"transaction_amount_money": {
"amount": 0,
"currency": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/programs/:program_id/calculate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"order_id": "",
"transaction_amount_money": {
"amount": 0,
"currency": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/programs/:program_id/calculate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate"
payload = {
"order_id": "",
"transaction_amount_money": {
"amount": 0,
"currency": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate"
payload <- "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/programs/:program_id/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/programs/:program_id/calculate') do |req|
req.body = "{\n \"order_id\": \"\",\n \"transaction_amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate";
let payload = json!({
"order_id": "",
"transaction_amount_money": json!({
"amount": 0,
"currency": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/programs/:program_id/calculate \
--header 'content-type: application/json' \
--data '{
"order_id": "",
"transaction_amount_money": {
"amount": 0,
"currency": ""
}
}'
echo '{
"order_id": "",
"transaction_amount_money": {
"amount": 0,
"currency": ""
}
}' | \
http POST {{baseUrl}}/v2/loyalty/programs/:program_id/calculate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "order_id": "",\n "transaction_amount_money": {\n "amount": 0,\n "currency": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/programs/:program_id/calculate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"order_id": "",
"transaction_amount_money": [
"amount": 0,
"currency": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/programs/:program_id/calculate")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"points": 6
}
POST
CreateLoyaltyAccount
{{baseUrl}}/v2/loyalty/accounts
BODY json
{
"idempotency_key": "",
"loyalty_account": {
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
{
"expires_at": "",
"points": 0
}
],
"id": "",
"lifetime_points": 0,
"mapping": {
"created_at": "",
"id": "",
"phone_number": ""
},
"program_id": "",
"updated_at": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/accounts");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/accounts" {:content-type :json
:form-params {:idempotency_key ""
:loyalty_account {:balance 0
:created_at ""
:customer_id ""
:enrolled_at ""
:expiring_point_deadlines [{:expires_at ""
:points 0}]
:id ""
:lifetime_points 0
:mapping {:created_at ""
:id ""
:phone_number ""}
:program_id ""
:updated_at ""}}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/accounts"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/accounts"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/accounts");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/accounts"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/accounts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 416
{
"idempotency_key": "",
"loyalty_account": {
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
{
"expires_at": "",
"points": 0
}
],
"id": "",
"lifetime_points": 0,
"mapping": {
"created_at": "",
"id": "",
"phone_number": ""
},
"program_id": "",
"updated_at": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/accounts")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/accounts"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/accounts")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
loyalty_account: {
balance: 0,
created_at: '',
customer_id: '',
enrolled_at: '',
expiring_point_deadlines: [
{
expires_at: '',
points: 0
}
],
id: '',
lifetime_points: 0,
mapping: {
created_at: '',
id: '',
phone_number: ''
},
program_id: '',
updated_at: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/accounts');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
loyalty_account: {
balance: 0,
created_at: '',
customer_id: '',
enrolled_at: '',
expiring_point_deadlines: [{expires_at: '', points: 0}],
id: '',
lifetime_points: 0,
mapping: {created_at: '', id: '', phone_number: ''},
program_id: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/accounts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","loyalty_account":{"balance":0,"created_at":"","customer_id":"","enrolled_at":"","expiring_point_deadlines":[{"expires_at":"","points":0}],"id":"","lifetime_points":0,"mapping":{"created_at":"","id":"","phone_number":""},"program_id":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/accounts',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "loyalty_account": {\n "balance": 0,\n "created_at": "",\n "customer_id": "",\n "enrolled_at": "",\n "expiring_point_deadlines": [\n {\n "expires_at": "",\n "points": 0\n }\n ],\n "id": "",\n "lifetime_points": 0,\n "mapping": {\n "created_at": "",\n "id": "",\n "phone_number": ""\n },\n "program_id": "",\n "updated_at": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/accounts',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
loyalty_account: {
balance: 0,
created_at: '',
customer_id: '',
enrolled_at: '',
expiring_point_deadlines: [{expires_at: '', points: 0}],
id: '',
lifetime_points: 0,
mapping: {created_at: '', id: '', phone_number: ''},
program_id: '',
updated_at: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
loyalty_account: {
balance: 0,
created_at: '',
customer_id: '',
enrolled_at: '',
expiring_point_deadlines: [{expires_at: '', points: 0}],
id: '',
lifetime_points: 0,
mapping: {created_at: '', id: '', phone_number: ''},
program_id: '',
updated_at: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/accounts');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
loyalty_account: {
balance: 0,
created_at: '',
customer_id: '',
enrolled_at: '',
expiring_point_deadlines: [
{
expires_at: '',
points: 0
}
],
id: '',
lifetime_points: 0,
mapping: {
created_at: '',
id: '',
phone_number: ''
},
program_id: '',
updated_at: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
loyalty_account: {
balance: 0,
created_at: '',
customer_id: '',
enrolled_at: '',
expiring_point_deadlines: [{expires_at: '', points: 0}],
id: '',
lifetime_points: 0,
mapping: {created_at: '', id: '', phone_number: ''},
program_id: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/accounts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","loyalty_account":{"balance":0,"created_at":"","customer_id":"","enrolled_at":"","expiring_point_deadlines":[{"expires_at":"","points":0}],"id":"","lifetime_points":0,"mapping":{"created_at":"","id":"","phone_number":""},"program_id":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"loyalty_account": @{ @"balance": @0, @"created_at": @"", @"customer_id": @"", @"enrolled_at": @"", @"expiring_point_deadlines": @[ @{ @"expires_at": @"", @"points": @0 } ], @"id": @"", @"lifetime_points": @0, @"mapping": @{ @"created_at": @"", @"id": @"", @"phone_number": @"" }, @"program_id": @"", @"updated_at": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/accounts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/accounts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'loyalty_account' => [
'balance' => 0,
'created_at' => '',
'customer_id' => '',
'enrolled_at' => '',
'expiring_point_deadlines' => [
[
'expires_at' => '',
'points' => 0
]
],
'id' => '',
'lifetime_points' => 0,
'mapping' => [
'created_at' => '',
'id' => '',
'phone_number' => ''
],
'program_id' => '',
'updated_at' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/accounts', [
'body' => '{
"idempotency_key": "",
"loyalty_account": {
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
{
"expires_at": "",
"points": 0
}
],
"id": "",
"lifetime_points": 0,
"mapping": {
"created_at": "",
"id": "",
"phone_number": ""
},
"program_id": "",
"updated_at": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/accounts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'loyalty_account' => [
'balance' => 0,
'created_at' => '',
'customer_id' => '',
'enrolled_at' => '',
'expiring_point_deadlines' => [
[
'expires_at' => '',
'points' => 0
]
],
'id' => '',
'lifetime_points' => 0,
'mapping' => [
'created_at' => '',
'id' => '',
'phone_number' => ''
],
'program_id' => '',
'updated_at' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'loyalty_account' => [
'balance' => 0,
'created_at' => '',
'customer_id' => '',
'enrolled_at' => '',
'expiring_point_deadlines' => [
[
'expires_at' => '',
'points' => 0
]
],
'id' => '',
'lifetime_points' => 0,
'mapping' => [
'created_at' => '',
'id' => '',
'phone_number' => ''
],
'program_id' => '',
'updated_at' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/accounts');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/accounts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"loyalty_account": {
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
{
"expires_at": "",
"points": 0
}
],
"id": "",
"lifetime_points": 0,
"mapping": {
"created_at": "",
"id": "",
"phone_number": ""
},
"program_id": "",
"updated_at": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/accounts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"loyalty_account": {
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
{
"expires_at": "",
"points": 0
}
],
"id": "",
"lifetime_points": 0,
"mapping": {
"created_at": "",
"id": "",
"phone_number": ""
},
"program_id": "",
"updated_at": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/accounts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/accounts"
payload = {
"idempotency_key": "",
"loyalty_account": {
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
{
"expires_at": "",
"points": 0
}
],
"id": "",
"lifetime_points": 0,
"mapping": {
"created_at": "",
"id": "",
"phone_number": ""
},
"program_id": "",
"updated_at": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/accounts"
payload <- "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/accounts') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"loyalty_account\": {\n \"balance\": 0,\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"enrolled_at\": \"\",\n \"expiring_point_deadlines\": [\n {\n \"expires_at\": \"\",\n \"points\": 0\n }\n ],\n \"id\": \"\",\n \"lifetime_points\": 0,\n \"mapping\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n },\n \"program_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/accounts";
let payload = json!({
"idempotency_key": "",
"loyalty_account": json!({
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": (
json!({
"expires_at": "",
"points": 0
})
),
"id": "",
"lifetime_points": 0,
"mapping": json!({
"created_at": "",
"id": "",
"phone_number": ""
}),
"program_id": "",
"updated_at": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/accounts \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"loyalty_account": {
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
{
"expires_at": "",
"points": 0
}
],
"id": "",
"lifetime_points": 0,
"mapping": {
"created_at": "",
"id": "",
"phone_number": ""
},
"program_id": "",
"updated_at": ""
}
}'
echo '{
"idempotency_key": "",
"loyalty_account": {
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
{
"expires_at": "",
"points": 0
}
],
"id": "",
"lifetime_points": 0,
"mapping": {
"created_at": "",
"id": "",
"phone_number": ""
},
"program_id": "",
"updated_at": ""
}
}' | \
http POST {{baseUrl}}/v2/loyalty/accounts \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "loyalty_account": {\n "balance": 0,\n "created_at": "",\n "customer_id": "",\n "enrolled_at": "",\n "expiring_point_deadlines": [\n {\n "expires_at": "",\n "points": 0\n }\n ],\n "id": "",\n "lifetime_points": 0,\n "mapping": {\n "created_at": "",\n "id": "",\n "phone_number": ""\n },\n "program_id": "",\n "updated_at": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/accounts
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"loyalty_account": [
"balance": 0,
"created_at": "",
"customer_id": "",
"enrolled_at": "",
"expiring_point_deadlines": [
[
"expires_at": "",
"points": 0
]
],
"id": "",
"lifetime_points": 0,
"mapping": [
"created_at": "",
"id": "",
"phone_number": ""
],
"program_id": "",
"updated_at": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/accounts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"loyalty_account": {
"balance": 0,
"created_at": "2020-05-08T21:44:32Z",
"id": "79b807d2-d786-46a9-933b-918028d7a8c5",
"lifetime_points": 0,
"mapping": {
"created_at": "2020-05-08T21:44:32Z",
"id": "66aaab3f-da99-49ed-8b19-b87f851c844f",
"phone_number": "+14155551234"
},
"program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"updated_at": "2020-05-08T21:44:32Z"
}
}
POST
CreateLoyaltyReward
{{baseUrl}}/v2/loyalty/rewards
BODY json
{
"idempotency_key": "",
"reward": {
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/rewards");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/rewards" {:content-type :json
:form-params {:idempotency_key ""
:reward {:created_at ""
:id ""
:loyalty_account_id ""
:order_id ""
:points 0
:redeemed_at ""
:reward_tier_id ""
:status ""
:updated_at ""}}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/rewards"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/rewards"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/rewards");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/rewards"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/rewards HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 237
{
"idempotency_key": "",
"reward": {
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/rewards")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/rewards"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/rewards")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
reward: {
created_at: '',
id: '',
loyalty_account_id: '',
order_id: '',
points: 0,
redeemed_at: '',
reward_tier_id: '',
status: '',
updated_at: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/rewards');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
reward: {
created_at: '',
id: '',
loyalty_account_id: '',
order_id: '',
points: 0,
redeemed_at: '',
reward_tier_id: '',
status: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/rewards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","reward":{"created_at":"","id":"","loyalty_account_id":"","order_id":"","points":0,"redeemed_at":"","reward_tier_id":"","status":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/rewards',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "reward": {\n "created_at": "",\n "id": "",\n "loyalty_account_id": "",\n "order_id": "",\n "points": 0,\n "redeemed_at": "",\n "reward_tier_id": "",\n "status": "",\n "updated_at": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/rewards',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
reward: {
created_at: '',
id: '',
loyalty_account_id: '',
order_id: '',
points: 0,
redeemed_at: '',
reward_tier_id: '',
status: '',
updated_at: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
reward: {
created_at: '',
id: '',
loyalty_account_id: '',
order_id: '',
points: 0,
redeemed_at: '',
reward_tier_id: '',
status: '',
updated_at: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/rewards');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
reward: {
created_at: '',
id: '',
loyalty_account_id: '',
order_id: '',
points: 0,
redeemed_at: '',
reward_tier_id: '',
status: '',
updated_at: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
reward: {
created_at: '',
id: '',
loyalty_account_id: '',
order_id: '',
points: 0,
redeemed_at: '',
reward_tier_id: '',
status: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/rewards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","reward":{"created_at":"","id":"","loyalty_account_id":"","order_id":"","points":0,"redeemed_at":"","reward_tier_id":"","status":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"reward": @{ @"created_at": @"", @"id": @"", @"loyalty_account_id": @"", @"order_id": @"", @"points": @0, @"redeemed_at": @"", @"reward_tier_id": @"", @"status": @"", @"updated_at": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/rewards"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/rewards" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/rewards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'reward' => [
'created_at' => '',
'id' => '',
'loyalty_account_id' => '',
'order_id' => '',
'points' => 0,
'redeemed_at' => '',
'reward_tier_id' => '',
'status' => '',
'updated_at' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/rewards', [
'body' => '{
"idempotency_key": "",
"reward": {
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/rewards');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'reward' => [
'created_at' => '',
'id' => '',
'loyalty_account_id' => '',
'order_id' => '',
'points' => 0,
'redeemed_at' => '',
'reward_tier_id' => '',
'status' => '',
'updated_at' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'reward' => [
'created_at' => '',
'id' => '',
'loyalty_account_id' => '',
'order_id' => '',
'points' => 0,
'redeemed_at' => '',
'reward_tier_id' => '',
'status' => '',
'updated_at' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/rewards');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/rewards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"reward": {
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/rewards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"reward": {
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/rewards", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/rewards"
payload = {
"idempotency_key": "",
"reward": {
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/rewards"
payload <- "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/rewards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/rewards') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"reward\": {\n \"created_at\": \"\",\n \"id\": \"\",\n \"loyalty_account_id\": \"\",\n \"order_id\": \"\",\n \"points\": 0,\n \"redeemed_at\": \"\",\n \"reward_tier_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/rewards";
let payload = json!({
"idempotency_key": "",
"reward": json!({
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/rewards \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"reward": {
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
}
}'
echo '{
"idempotency_key": "",
"reward": {
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
}
}' | \
http POST {{baseUrl}}/v2/loyalty/rewards \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "reward": {\n "created_at": "",\n "id": "",\n "loyalty_account_id": "",\n "order_id": "",\n "points": 0,\n "redeemed_at": "",\n "reward_tier_id": "",\n "status": "",\n "updated_at": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/rewards
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"reward": [
"created_at": "",
"id": "",
"loyalty_account_id": "",
"order_id": "",
"points": 0,
"redeemed_at": "",
"reward_tier_id": "",
"status": "",
"updated_at": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/rewards")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"reward": {
"created_at": "2020-05-01T21:49:54Z",
"id": "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
"points": 10,
"reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"status": "ISSUED",
"updated_at": "2020-05-01T21:49:54Z"
}
}
DELETE
DeleteLoyaltyReward
{{baseUrl}}/v2/loyalty/rewards/:reward_id
QUERY PARAMS
reward_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/rewards/:reward_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/loyalty/rewards/:reward_id")
require "http/client"
url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/rewards/:reward_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/rewards/:reward_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/rewards/:reward_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/loyalty/rewards/:reward_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/loyalty/rewards/:reward_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/rewards/:reward_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards/:reward_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/loyalty/rewards/:reward_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/loyalty/rewards/:reward_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/rewards/:reward_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards/:reward_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/rewards/:reward_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/loyalty/rewards/:reward_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/rewards/:reward_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/rewards/:reward_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/rewards/:reward_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/rewards/:reward_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/loyalty/rewards/:reward_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/rewards/:reward_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/loyalty/rewards/:reward_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/rewards/:reward_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/rewards/:reward_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/loyalty/rewards/:reward_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/rewards/:reward_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/rewards/:reward_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/loyalty/rewards/:reward_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/loyalty/rewards/:reward_id
http DELETE {{baseUrl}}/v2/loyalty/rewards/:reward_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/loyalty/rewards/:reward_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/rewards/:reward_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
GET
ListLoyaltyPrograms
{{baseUrl}}/v2/loyalty/programs
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/programs");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/loyalty/programs")
require "http/client"
url = "{{baseUrl}}/v2/loyalty/programs"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/programs"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/programs");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/programs"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/loyalty/programs HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/loyalty/programs")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/programs"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/programs")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/loyalty/programs")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/loyalty/programs');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/loyalty/programs'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/programs';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/programs',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/programs")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/programs',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/loyalty/programs'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/loyalty/programs');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/loyalty/programs'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/programs';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/programs"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/programs" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/programs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/loyalty/programs');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/programs');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/loyalty/programs');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/programs' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/programs' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/loyalty/programs")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/programs"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/programs"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/programs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/loyalty/programs') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/programs";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/loyalty/programs
http GET {{baseUrl}}/v2/loyalty/programs
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/loyalty/programs
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/programs")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"programs": [
{
"accrual_rules": [
{
"accrual_type": "SPEND",
"excluded_category_ids": [
"7ZERJKO5PVYXCVUHV2JCZ2UG",
"FQKAOJE5C4FIMF5A2URMLW6V"
],
"excluded_item_variation_ids": [
"CBZXBUVVTYUBZGQO44RHMR6B",
"EDILT24Z2NISEXDKGY6HP7XV"
],
"points": 1,
"spend_amount_money": {
"amount": 100
}
}
],
"created_at": "2020-04-20T16:55:11Z",
"id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"location_ids": [
"P034NEENMD09F"
],
"reward_tiers": [
{
"created_at": "2020-04-20T16:55:11Z",
"definition": {
"discount_type": "FIXED_PERCENTAGE",
"percentage_discount": "10",
"scope": "ORDER"
},
"id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"name": "10% off entire sale",
"points": 10,
"pricing_rule_reference": {
"catalog_version": "1605486402527",
"object_id": "74C4JSHESNLTB2A7ITO5HO6F"
}
}
],
"status": "ACTIVE",
"terminology": {
"one": "Point",
"other": "Points"
},
"updated_at": "2020-05-01T02:00:02Z"
}
]
}
POST
RedeemLoyaltyReward
{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem
QUERY PARAMS
reward_id
BODY json
{
"idempotency_key": "",
"location_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem" {:content-type :json
:form-params {:idempotency_key ""
:location_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/rewards/:reward_id/redeem HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 48
{
"idempotency_key": "",
"location_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
location_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem',
headers: {'content-type': 'application/json'},
data: {idempotency_key: '', location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","location_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "location_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/rewards/:reward_id/redeem',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({idempotency_key: '', location_id: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem',
headers: {'content-type': 'application/json'},
body: {idempotency_key: '', location_id: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
location_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem',
headers: {'content-type': 'application/json'},
data: {idempotency_key: '', location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","location_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"location_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'location_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem', [
'body' => '{
"idempotency_key": "",
"location_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'location_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'location_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"location_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"location_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/rewards/:reward_id/redeem", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem"
payload = {
"idempotency_key": "",
"location_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem"
payload <- "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/rewards/:reward_id/redeem') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"location_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem";
let payload = json!({
"idempotency_key": "",
"location_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"location_id": ""
}'
echo '{
"idempotency_key": "",
"location_id": ""
}' | \
http POST {{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "location_id": ""\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"location_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/rewards/:reward_id/redeem")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"event": {
"created_at": "2020-05-08T21:56:00Z",
"id": "67377a6e-dbdc-369d-aa16-2e7ed422e71f",
"location_id": "P034NEENMD09F",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"redeem_reward": {
"loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"reward_id": "9f18ac21-233a-31c3-be77-b45840f5a810"
},
"source": "LOYALTY_API",
"type": "REDEEM_REWARD"
}
}
GET
RetrieveLoyaltyAccount
{{baseUrl}}/v2/loyalty/accounts/:account_id
QUERY PARAMS
account_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/accounts/:account_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/loyalty/accounts/:account_id")
require "http/client"
url = "{{baseUrl}}/v2/loyalty/accounts/:account_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/accounts/:account_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/accounts/:account_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/accounts/:account_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/loyalty/accounts/:account_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/loyalty/accounts/:account_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/accounts/:account_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts/:account_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/loyalty/accounts/:account_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/loyalty/accounts/:account_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/accounts/:account_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts/:account_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/accounts/:account_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/loyalty/accounts/:account_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/accounts/:account_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/accounts/:account_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/accounts/:account_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/accounts/:account_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/accounts/:account_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/loyalty/accounts/:account_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/accounts/:account_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/loyalty/accounts/:account_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/accounts/:account_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/accounts/:account_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/loyalty/accounts/:account_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/accounts/:account_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/accounts/:account_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/accounts/:account_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/loyalty/accounts/:account_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/accounts/:account_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/loyalty/accounts/:account_id
http GET {{baseUrl}}/v2/loyalty/accounts/:account_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/loyalty/accounts/:account_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/accounts/:account_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"loyalty_account": {
"balance": 10,
"created_at": "2020-05-08T21:44:32Z",
"customer_id": "Q8002FAM9V1EZ0ADB2T5609X6NET1H0",
"id": "79b807d2-d786-46a9-933b-918028d7a8c5",
"lifetime_points": 20,
"mapping": {
"created_at": "2020-05-08T21:44:32Z",
"id": "66aaab3f-da99-49ed-8b19-b87f851c844f",
"phone_number": "+14155551234"
},
"program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"updated_at": "2020-05-08T21:44:32Z"
}
}
GET
RetrieveLoyaltyProgram
{{baseUrl}}/v2/loyalty/programs/:program_id
QUERY PARAMS
program_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/programs/:program_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/loyalty/programs/:program_id")
require "http/client"
url = "{{baseUrl}}/v2/loyalty/programs/:program_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/programs/:program_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/programs/:program_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/programs/:program_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/loyalty/programs/:program_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/loyalty/programs/:program_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/programs/:program_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/programs/:program_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/loyalty/programs/:program_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/loyalty/programs/:program_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/programs/:program_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/programs/:program_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/programs/:program_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/programs/:program_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/programs/:program_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/programs/:program_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/loyalty/programs/:program_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/programs/:program_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/programs/:program_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/programs/:program_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/programs/:program_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/programs/:program_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/loyalty/programs/:program_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/programs/:program_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/loyalty/programs/:program_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/programs/:program_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/programs/:program_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/loyalty/programs/:program_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/programs/:program_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/programs/:program_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/programs/:program_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/loyalty/programs/:program_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/programs/:program_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/loyalty/programs/:program_id
http GET {{baseUrl}}/v2/loyalty/programs/:program_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/loyalty/programs/:program_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/programs/:program_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"program": {
"accrual_rules": [
{
"accrual_type": "SPEND",
"excluded_category_ids": [
"7ZERJKO5PVYXCVUHV2JCZ2UG",
"FQKAOJE5C4FIMF5A2URMLW6V"
],
"excluded_item_variation_ids": [
"CBZXBUVVTYUBZGQO44RHMR6B",
"EDILT24Z2NISEXDKGY6HP7XV"
],
"points": 1,
"spend_amount_money": {
"amount": 100
}
}
],
"created_at": "2020-04-20T16:55:11Z",
"id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"location_ids": [
"P034NEENMD09F"
],
"reward_tiers": [
{
"created_at": "2020-04-20T16:55:11Z",
"definition": {
"discount_type": "FIXED_PERCENTAGE",
"percentage_discount": "10",
"scope": "ORDER"
},
"id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"name": "10% off entire sale",
"points": 10,
"pricing_rule_reference": {
"catalog_version": "1605486402527",
"object_id": "74C4JSHESNLTB2A7ITO5HO6F"
}
}
],
"status": "ACTIVE",
"terminology": {
"one": "Point",
"other": "Points"
},
"updated_at": "2020-05-01T02:00:02Z"
}
}
GET
RetrieveLoyaltyReward
{{baseUrl}}/v2/loyalty/rewards/:reward_id
QUERY PARAMS
reward_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/rewards/:reward_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/loyalty/rewards/:reward_id")
require "http/client"
url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/rewards/:reward_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/rewards/:reward_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/rewards/:reward_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/loyalty/rewards/:reward_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/loyalty/rewards/:reward_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/rewards/:reward_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards/:reward_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/loyalty/rewards/:reward_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/loyalty/rewards/:reward_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/rewards/:reward_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards/:reward_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/rewards/:reward_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/loyalty/rewards/:reward_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/loyalty/rewards/:reward_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/rewards/:reward_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/rewards/:reward_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/rewards/:reward_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/rewards/:reward_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/loyalty/rewards/:reward_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/rewards/:reward_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/loyalty/rewards/:reward_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/rewards/:reward_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/rewards/:reward_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/loyalty/rewards/:reward_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/rewards/:reward_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/rewards/:reward_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/loyalty/rewards/:reward_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/rewards/:reward_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/loyalty/rewards/:reward_id
http GET {{baseUrl}}/v2/loyalty/rewards/:reward_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/loyalty/rewards/:reward_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/rewards/:reward_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"reward": {
"created_at": "2020-05-08T21:55:42Z",
"id": "9f18ac21-233a-31c3-be77-b45840f5a810",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"points": 10,
"redeemed_at": "2020-05-08T21:56:00Z",
"reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"status": "REDEEMED",
"updated_at": "2020-05-08T21:56:00Z"
}
}
POST
SearchLoyaltyAccounts
{{baseUrl}}/v2/loyalty/accounts/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"customer_ids": [],
"mappings": [
{
"created_at": "",
"id": "",
"phone_number": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/accounts/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/accounts/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:customer_ids []
:mappings [{:created_at ""
:id ""
:phone_number ""}]}}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/accounts/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/accounts/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/accounts/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/accounts/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/accounts/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 185
{
"cursor": "",
"limit": 0,
"query": {
"customer_ids": [],
"mappings": [
{
"created_at": "",
"id": "",
"phone_number": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/accounts/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/accounts/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/accounts/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
customer_ids: [],
mappings: [
{
created_at: '',
id: '',
phone_number: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/accounts/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {customer_ids: [], mappings: [{created_at: '', id: '', phone_number: ''}]}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/accounts/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"customer_ids":[],"mappings":[{"created_at":"","id":"","phone_number":""}]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/accounts/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "customer_ids": [],\n "mappings": [\n {\n "created_at": "",\n "id": "",\n "phone_number": ""\n }\n ]\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/accounts/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/accounts/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cursor: '',
limit: 0,
query: {customer_ids: [], mappings: [{created_at: '', id: '', phone_number: ''}]}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/search',
headers: {'content-type': 'application/json'},
body: {
cursor: '',
limit: 0,
query: {customer_ids: [], mappings: [{created_at: '', id: '', phone_number: ''}]}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/accounts/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
customer_ids: [],
mappings: [
{
created_at: '',
id: '',
phone_number: ''
}
]
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/accounts/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {customer_ids: [], mappings: [{created_at: '', id: '', phone_number: ''}]}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/accounts/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"customer_ids":[],"mappings":[{"created_at":"","id":"","phone_number":""}]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"customer_ids": @[ ], @"mappings": @[ @{ @"created_at": @"", @"id": @"", @"phone_number": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/accounts/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/accounts/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/accounts/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'customer_ids' => [
],
'mappings' => [
[
'created_at' => '',
'id' => '',
'phone_number' => ''
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/accounts/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"customer_ids": [],
"mappings": [
{
"created_at": "",
"id": "",
"phone_number": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/accounts/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'customer_ids' => [
],
'mappings' => [
[
'created_at' => '',
'id' => '',
'phone_number' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'customer_ids' => [
],
'mappings' => [
[
'created_at' => '',
'id' => '',
'phone_number' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/accounts/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/accounts/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"customer_ids": [],
"mappings": [
{
"created_at": "",
"id": "",
"phone_number": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/accounts/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"customer_ids": [],
"mappings": [
{
"created_at": "",
"id": "",
"phone_number": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/accounts/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/accounts/search"
payload = {
"cursor": "",
"limit": 0,
"query": {
"customer_ids": [],
"mappings": [
{
"created_at": "",
"id": "",
"phone_number": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/accounts/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/accounts/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/accounts/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"customer_ids\": [],\n \"mappings\": [\n {\n \"created_at\": \"\",\n \"id\": \"\",\n \"phone_number\": \"\"\n }\n ]\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/accounts/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({
"customer_ids": (),
"mappings": (
json!({
"created_at": "",
"id": "",
"phone_number": ""
})
)
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/accounts/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"customer_ids": [],
"mappings": [
{
"created_at": "",
"id": "",
"phone_number": ""
}
]
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"customer_ids": [],
"mappings": [
{
"created_at": "",
"id": "",
"phone_number": ""
}
]
}
}' | \
http POST {{baseUrl}}/v2/loyalty/accounts/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "customer_ids": [],\n "mappings": [\n {\n "created_at": "",\n "id": "",\n "phone_number": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/accounts/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": [
"customer_ids": [],
"mappings": [
[
"created_at": "",
"id": "",
"phone_number": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/accounts/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"loyalty_accounts": [
{
"balance": 10,
"created_at": "2020-05-08T21:44:32Z",
"customer_id": "Q8002FAM9V1EZ0ADB2T5609X6NET1H0",
"id": "79b807d2-d786-46a9-933b-918028d7a8c5",
"lifetime_points": 20,
"mapping": {
"created_at": "2020-05-08T21:44:32Z",
"id": "66aaab3f-da99-49ed-8b19-b87f851c844f",
"phone_number": "+14155551234"
},
"program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"updated_at": "2020-05-08T21:44:32Z"
}
]
}
POST
SearchLoyaltyEvents
{{baseUrl}}/v2/loyalty/events/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"date_time_filter": {
"created_at": {
"end_at": "",
"start_at": ""
}
},
"location_filter": {
"location_ids": []
},
"loyalty_account_filter": {
"loyalty_account_id": ""
},
"order_filter": {
"order_id": ""
},
"type_filter": {
"types": []
}
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/events/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/events/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:filter {:date_time_filter {:created_at {:end_at ""
:start_at ""}}
:location_filter {:location_ids []}
:loyalty_account_filter {:loyalty_account_id ""}
:order_filter {:order_id ""}
:type_filter {:types []}}}}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/events/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/events/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/events/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/events/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/events/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 438
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"date_time_filter": {
"created_at": {
"end_at": "",
"start_at": ""
}
},
"location_filter": {
"location_ids": []
},
"loyalty_account_filter": {
"loyalty_account_id": ""
},
"order_filter": {
"order_id": ""
},
"type_filter": {
"types": []
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/events/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/events/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/events/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/events/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
date_time_filter: {
created_at: {
end_at: '',
start_at: ''
}
},
location_filter: {
location_ids: []
},
loyalty_account_filter: {
loyalty_account_id: ''
},
order_filter: {
order_id: ''
},
type_filter: {
types: []
}
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/events/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/events/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {
date_time_filter: {created_at: {end_at: '', start_at: ''}},
location_filter: {location_ids: []},
loyalty_account_filter: {loyalty_account_id: ''},
order_filter: {order_id: ''},
type_filter: {types: []}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/events/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"date_time_filter":{"created_at":{"end_at":"","start_at":""}},"location_filter":{"location_ids":[]},"loyalty_account_filter":{"loyalty_account_id":""},"order_filter":{"order_id":""},"type_filter":{"types":[]}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/events/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "date_time_filter": {\n "created_at": {\n "end_at": "",\n "start_at": ""\n }\n },\n "location_filter": {\n "location_ids": []\n },\n "loyalty_account_filter": {\n "loyalty_account_id": ""\n },\n "order_filter": {\n "order_id": ""\n },\n "type_filter": {\n "types": []\n }\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/events/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/events/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
date_time_filter: {created_at: {end_at: '', start_at: ''}},
location_filter: {location_ids: []},
loyalty_account_filter: {loyalty_account_id: ''},
order_filter: {order_id: ''},
type_filter: {types: []}
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/events/search',
headers: {'content-type': 'application/json'},
body: {
cursor: '',
limit: 0,
query: {
filter: {
date_time_filter: {created_at: {end_at: '', start_at: ''}},
location_filter: {location_ids: []},
loyalty_account_filter: {loyalty_account_id: ''},
order_filter: {order_id: ''},
type_filter: {types: []}
}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/events/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
filter: {
date_time_filter: {
created_at: {
end_at: '',
start_at: ''
}
},
location_filter: {
location_ids: []
},
loyalty_account_filter: {
loyalty_account_id: ''
},
order_filter: {
order_id: ''
},
type_filter: {
types: []
}
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/events/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {
date_time_filter: {created_at: {end_at: '', start_at: ''}},
location_filter: {location_ids: []},
loyalty_account_filter: {loyalty_account_id: ''},
order_filter: {order_id: ''},
type_filter: {types: []}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/events/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"date_time_filter":{"created_at":{"end_at":"","start_at":""}},"location_filter":{"location_ids":[]},"loyalty_account_filter":{"loyalty_account_id":""},"order_filter":{"order_id":""},"type_filter":{"types":[]}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"filter": @{ @"date_time_filter": @{ @"created_at": @{ @"end_at": @"", @"start_at": @"" } }, @"location_filter": @{ @"location_ids": @[ ] }, @"loyalty_account_filter": @{ @"loyalty_account_id": @"" }, @"order_filter": @{ @"order_id": @"" }, @"type_filter": @{ @"types": @[ ] } } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/events/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/events/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/events/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'date_time_filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
]
],
'location_filter' => [
'location_ids' => [
]
],
'loyalty_account_filter' => [
'loyalty_account_id' => ''
],
'order_filter' => [
'order_id' => ''
],
'type_filter' => [
'types' => [
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/events/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"date_time_filter": {
"created_at": {
"end_at": "",
"start_at": ""
}
},
"location_filter": {
"location_ids": []
},
"loyalty_account_filter": {
"loyalty_account_id": ""
},
"order_filter": {
"order_id": ""
},
"type_filter": {
"types": []
}
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/events/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'date_time_filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
]
],
'location_filter' => [
'location_ids' => [
]
],
'loyalty_account_filter' => [
'loyalty_account_id' => ''
],
'order_filter' => [
'order_id' => ''
],
'type_filter' => [
'types' => [
]
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'date_time_filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
]
],
'location_filter' => [
'location_ids' => [
]
],
'loyalty_account_filter' => [
'loyalty_account_id' => ''
],
'order_filter' => [
'order_id' => ''
],
'type_filter' => [
'types' => [
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/events/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/events/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"date_time_filter": {
"created_at": {
"end_at": "",
"start_at": ""
}
},
"location_filter": {
"location_ids": []
},
"loyalty_account_filter": {
"loyalty_account_id": ""
},
"order_filter": {
"order_id": ""
},
"type_filter": {
"types": []
}
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/events/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"date_time_filter": {
"created_at": {
"end_at": "",
"start_at": ""
}
},
"location_filter": {
"location_ids": []
},
"loyalty_account_filter": {
"loyalty_account_id": ""
},
"order_filter": {
"order_id": ""
},
"type_filter": {
"types": []
}
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/events/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/events/search"
payload = {
"cursor": "",
"limit": 0,
"query": { "filter": {
"date_time_filter": { "created_at": {
"end_at": "",
"start_at": ""
} },
"location_filter": { "location_ids": [] },
"loyalty_account_filter": { "loyalty_account_id": "" },
"order_filter": { "order_id": "" },
"type_filter": { "types": [] }
} }
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/events/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/events/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/events/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"date_time_filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n }\n },\n \"location_filter\": {\n \"location_ids\": []\n },\n \"loyalty_account_filter\": {\n \"loyalty_account_id\": \"\"\n },\n \"order_filter\": {\n \"order_id\": \"\"\n },\n \"type_filter\": {\n \"types\": []\n }\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/events/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({"filter": json!({
"date_time_filter": json!({"created_at": json!({
"end_at": "",
"start_at": ""
})}),
"location_filter": json!({"location_ids": ()}),
"loyalty_account_filter": json!({"loyalty_account_id": ""}),
"order_filter": json!({"order_id": ""}),
"type_filter": json!({"types": ()})
})})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/events/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"date_time_filter": {
"created_at": {
"end_at": "",
"start_at": ""
}
},
"location_filter": {
"location_ids": []
},
"loyalty_account_filter": {
"loyalty_account_id": ""
},
"order_filter": {
"order_id": ""
},
"type_filter": {
"types": []
}
}
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"date_time_filter": {
"created_at": {
"end_at": "",
"start_at": ""
}
},
"location_filter": {
"location_ids": []
},
"loyalty_account_filter": {
"loyalty_account_id": ""
},
"order_filter": {
"order_id": ""
},
"type_filter": {
"types": []
}
}
}
}' | \
http POST {{baseUrl}}/v2/loyalty/events/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "date_time_filter": {\n "created_at": {\n "end_at": "",\n "start_at": ""\n }\n },\n "location_filter": {\n "location_ids": []\n },\n "loyalty_account_filter": {\n "loyalty_account_id": ""\n },\n "order_filter": {\n "order_id": ""\n },\n "type_filter": {\n "types": []\n }\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/events/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": ["filter": [
"date_time_filter": ["created_at": [
"end_at": "",
"start_at": ""
]],
"location_filter": ["location_ids": []],
"loyalty_account_filter": ["loyalty_account_id": ""],
"order_filter": ["order_id": ""],
"type_filter": ["types": []]
]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/events/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"events": [
{
"accumulate_points": {
"loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY",
"points": 5
},
"created_at": "2020-05-08T22:01:30Z",
"id": "c27c8465-806e-36f2-b4b3-71f5887b5ba8",
"location_id": "P034NEENMD09F",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"source": "LOYALTY_API",
"type": "ACCUMULATE_POINTS"
},
{
"created_at": "2020-05-08T22:01:15Z",
"id": "e4a5cbc3-a4d0-3779-98e9-e578885d9430",
"location_id": "P034NEENMD09F",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"redeem_reward": {
"loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY",
"reward_id": "d03f79f4-815f-3500-b851-cc1e68a457f9"
},
"source": "LOYALTY_API",
"type": "REDEEM_REWARD"
},
{
"create_reward": {
"loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd",
"points": -10,
"reward_id": "d03f79f4-815f-3500-b851-cc1e68a457f9"
},
"created_at": "2020-05-08T22:00:44Z",
"id": "5e127479-0b03-3671-ab1e-15faea8b7188",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"source": "LOYALTY_API",
"type": "CREATE_REWARD"
}
]
}
POST
SearchLoyaltyRewards
{{baseUrl}}/v2/loyalty/rewards/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"loyalty_account_id": "",
"status": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/loyalty/rewards/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/loyalty/rewards/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:loyalty_account_id ""
:status ""}}})
require "http/client"
url = "{{baseUrl}}/v2/loyalty/rewards/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/loyalty/rewards/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/loyalty/rewards/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/loyalty/rewards/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/loyalty/rewards/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 97
{
"cursor": "",
"limit": 0,
"query": {
"loyalty_account_id": "",
"status": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/loyalty/rewards/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/loyalty/rewards/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/loyalty/rewards/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
loyalty_account_id: '',
status: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/loyalty/rewards/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards/search',
headers: {'content-type': 'application/json'},
data: {cursor: '', limit: 0, query: {loyalty_account_id: '', status: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/loyalty/rewards/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"loyalty_account_id":"","status":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/loyalty/rewards/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "loyalty_account_id": "",\n "status": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/loyalty/rewards/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/loyalty/rewards/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({cursor: '', limit: 0, query: {loyalty_account_id: '', status: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards/search',
headers: {'content-type': 'application/json'},
body: {cursor: '', limit: 0, query: {loyalty_account_id: '', status: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/loyalty/rewards/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
loyalty_account_id: '',
status: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/loyalty/rewards/search',
headers: {'content-type': 'application/json'},
data: {cursor: '', limit: 0, query: {loyalty_account_id: '', status: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/loyalty/rewards/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"loyalty_account_id":"","status":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"loyalty_account_id": @"", @"status": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/loyalty/rewards/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/loyalty/rewards/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/loyalty/rewards/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'loyalty_account_id' => '',
'status' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/loyalty/rewards/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"loyalty_account_id": "",
"status": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/loyalty/rewards/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'loyalty_account_id' => '',
'status' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'loyalty_account_id' => '',
'status' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/loyalty/rewards/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/loyalty/rewards/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"loyalty_account_id": "",
"status": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/loyalty/rewards/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"loyalty_account_id": "",
"status": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/loyalty/rewards/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/loyalty/rewards/search"
payload = {
"cursor": "",
"limit": 0,
"query": {
"loyalty_account_id": "",
"status": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/loyalty/rewards/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/loyalty/rewards/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/loyalty/rewards/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"loyalty_account_id\": \"\",\n \"status\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/loyalty/rewards/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({
"loyalty_account_id": "",
"status": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/loyalty/rewards/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"loyalty_account_id": "",
"status": ""
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"loyalty_account_id": "",
"status": ""
}
}' | \
http POST {{baseUrl}}/v2/loyalty/rewards/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "loyalty_account_id": "",\n "status": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/loyalty/rewards/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": [
"loyalty_account_id": "",
"status": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/loyalty/rewards/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"rewards": [
{
"created_at": "2020-05-08T22:00:44Z",
"id": "d03f79f4-815f-3500-b851-cc1e68a457f9",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY",
"points": 10,
"redeemed_at": "2020-05-08T22:01:17Z",
"reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"status": "REDEEMED",
"updated_at": "2020-05-08T22:01:17Z"
},
{
"created_at": "2020-05-08T21:55:42Z",
"id": "9f18ac21-233a-31c3-be77-b45840f5a810",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"points": 10,
"redeemed_at": "2020-05-08T21:56:00Z",
"reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"status": "REDEEMED",
"updated_at": "2020-05-08T21:56:00Z"
},
{
"created_at": "2020-05-01T21:49:54Z",
"id": "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"order_id": "5NB69ZNh3FbsOs1ox43bh1xrli6YY",
"points": 10,
"reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"status": "DELETED",
"updated_at": "2020-05-08T21:55:10Z"
},
{
"created_at": "2020-05-01T20:20:37Z",
"id": "a051254c-f840-3b45-8cf1-50bcd38ff92a",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"order_id": "LQQ16znvi2VIUKPVhUfJefzr1eEZY",
"points": 10,
"reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"status": "ISSUED",
"updated_at": "2020-05-01T20:20:40Z"
}
]
}
GET
ListMerchants
{{baseUrl}}/v2/merchants
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/merchants");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/merchants")
require "http/client"
url = "{{baseUrl}}/v2/merchants"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/merchants"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/merchants");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/merchants"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/merchants HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/merchants")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/merchants"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/merchants")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/merchants")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/merchants');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/merchants'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/merchants';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/merchants',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/merchants")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/merchants',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/merchants'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/merchants');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/merchants'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/merchants';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/merchants"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/merchants" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/merchants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/merchants');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/merchants');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/merchants');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/merchants' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/merchants' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/merchants")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/merchants"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/merchants"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/merchants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/merchants') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/merchants";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/merchants
http GET {{baseUrl}}/v2/merchants
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/merchants
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/merchants")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"merchant": [
{
"business_name": "Apple A Day",
"country": "US",
"currency": "USD",
"id": "DM7VKY8Q63GNP",
"language_code": "en-US",
"main_location_id": "9A65CGC72ZQG1",
"status": "ACTIVE"
}
]
}
GET
RetrieveMerchant
{{baseUrl}}/v2/merchants/:merchant_id
QUERY PARAMS
merchant_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/merchants/:merchant_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/merchants/:merchant_id")
require "http/client"
url = "{{baseUrl}}/v2/merchants/:merchant_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/merchants/:merchant_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/merchants/:merchant_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/merchants/:merchant_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/merchants/:merchant_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/merchants/:merchant_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/merchants/:merchant_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/merchants/:merchant_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/merchants/:merchant_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/merchants/:merchant_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/merchants/:merchant_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/merchants/:merchant_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/merchants/:merchant_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/merchants/:merchant_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/merchants/:merchant_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/merchants/:merchant_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/merchants/:merchant_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/merchants/:merchant_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/merchants/:merchant_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/merchants/:merchant_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/merchants/:merchant_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/merchants/:merchant_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/merchants/:merchant_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/merchants/:merchant_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/merchants/:merchant_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/merchants/:merchant_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/merchants/:merchant_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/merchants/:merchant_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/merchants/:merchant_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/merchants/:merchant_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/merchants/:merchant_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/merchants/:merchant_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/merchants/:merchant_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/merchants/:merchant_id
http GET {{baseUrl}}/v2/merchants/:merchant_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/merchants/:merchant_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/merchants/:merchant_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"merchant": {
"business_name": "Apple A Day",
"country": "US",
"currency": "USD",
"id": "DM7VKY8Q63GNP",
"language_code": "en-US",
"main_location_id": "9A65CGC72ZQG1",
"status": "ACTIVE"
}
}
POST
CreateMobileAuthorizationCode
{{baseUrl}}/mobile/authorization-code
BODY json
{
"location_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mobile/authorization-code");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"location_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/mobile/authorization-code" {:content-type :json
:form-params {:location_id ""}})
require "http/client"
url = "{{baseUrl}}/mobile/authorization-code"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"location_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/mobile/authorization-code"),
Content = new StringContent("{\n \"location_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mobile/authorization-code");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"location_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mobile/authorization-code"
payload := strings.NewReader("{\n \"location_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/mobile/authorization-code HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 23
{
"location_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/mobile/authorization-code")
.setHeader("content-type", "application/json")
.setBody("{\n \"location_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mobile/authorization-code"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"location_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"location_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/mobile/authorization-code")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/mobile/authorization-code")
.header("content-type", "application/json")
.body("{\n \"location_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
location_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/mobile/authorization-code');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/mobile/authorization-code',
headers: {'content-type': 'application/json'},
data: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mobile/authorization-code';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"location_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/mobile/authorization-code',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "location_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"location_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/mobile/authorization-code")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/mobile/authorization-code',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({location_id: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/mobile/authorization-code',
headers: {'content-type': 'application/json'},
body: {location_id: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/mobile/authorization-code');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
location_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/mobile/authorization-code',
headers: {'content-type': 'application/json'},
data: {location_id: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mobile/authorization-code';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"location_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"location_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/mobile/authorization-code"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/mobile/authorization-code" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"location_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mobile/authorization-code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/mobile/authorization-code', [
'body' => '{
"location_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/mobile/authorization-code');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'location_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'location_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/mobile/authorization-code');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mobile/authorization-code' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"location_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mobile/authorization-code' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"location_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"location_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/mobile/authorization-code", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mobile/authorization-code"
payload = { "location_id": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mobile/authorization-code"
payload <- "{\n \"location_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mobile/authorization-code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"location_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/mobile/authorization-code') do |req|
req.body = "{\n \"location_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mobile/authorization-code";
let payload = json!({"location_id": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/mobile/authorization-code \
--header 'content-type: application/json' \
--data '{
"location_id": ""
}'
echo '{
"location_id": ""
}' | \
http POST {{baseUrl}}/mobile/authorization-code \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "location_id": ""\n}' \
--output-document \
- {{baseUrl}}/mobile/authorization-code
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["location_id": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mobile/authorization-code")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"authorization_code": "YOUR_MOBILE_AUTHORIZATION_CODE",
"expires_at": "2019-01-10T19:42:08Z"
}
POST
ObtainToken
{{baseUrl}}/oauth2/token
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/oauth2/token");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/oauth2/token")
require "http/client"
url = "{{baseUrl}}/oauth2/token"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/oauth2/token"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/oauth2/token");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/oauth2/token"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/oauth2/token HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/oauth2/token")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/oauth2/token"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/oauth2/token")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/oauth2/token")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/oauth2/token');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/oauth2/token'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/oauth2/token';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/oauth2/token',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/oauth2/token")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/oauth2/token',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'POST', url: '{{baseUrl}}/oauth2/token'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/oauth2/token');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'POST', url: '{{baseUrl}}/oauth2/token'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/oauth2/token';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/oauth2/token"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/oauth2/token" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/oauth2/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/oauth2/token');
echo $response->getBody();
setUrl('{{baseUrl}}/oauth2/token');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/oauth2/token');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/oauth2/token' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/oauth2/token' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/oauth2/token")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/oauth2/token"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/oauth2/token"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/oauth2/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/oauth2/token') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/oauth2/token";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/oauth2/token
http POST {{baseUrl}}/oauth2/token
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/oauth2/token
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/oauth2/token")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
RenewToken
{{baseUrl}}/oauth2/clients/:client_id/access-token/renew
HEADERS
Authorization
{{apiKey}}
QUERY PARAMS
client_id
BODY json
{
"access_token": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"access_token\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew" {:headers {:authorization "{{apiKey}}"}
:content-type :json
:form-params {:access_token ""}})
require "http/client"
url = "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew"
headers = HTTP::Headers{
"authorization" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"access_token\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/oauth2/clients/:client_id/access-token/renew"),
Headers =
{
{ "authorization", "{{apiKey}}" },
},
Content = new StringContent("{\n \"access_token\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/oauth2/clients/:client_id/access-token/renew");
var request = new RestRequest("", Method.Post);
request.AddHeader("authorization", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"access_token\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew"
payload := strings.NewReader("{\n \"access_token\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/oauth2/clients/:client_id/access-token/renew HTTP/1.1
Authorization: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 24
{
"access_token": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew")
.setHeader("authorization", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"access_token\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/oauth2/clients/:client_id/access-token/renew"))
.header("authorization", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"access_token\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"access_token\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/oauth2/clients/:client_id/access-token/renew")
.post(body)
.addHeader("authorization", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/oauth2/clients/:client_id/access-token/renew")
.header("authorization", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"access_token\": \"\"\n}")
.asString();
const data = JSON.stringify({
access_token: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew');
xhr.setRequestHeader('authorization', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
data: {access_token: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew';
const options = {
method: 'POST',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
body: '{"access_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew',
method: 'POST',
headers: {
authorization: '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "access_token": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"access_token\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/oauth2/clients/:client_id/access-token/renew")
.post(body)
.addHeader("authorization", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/oauth2/clients/:client_id/access-token/renew',
headers: {
authorization: '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({access_token: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
body: {access_token: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew');
req.headers({
authorization: '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
access_token: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
data: {access_token: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew';
const options = {
method: 'POST',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
body: '{"access_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"access_token": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/oauth2/clients/:client_id/access-token/renew"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew" in
let headers = Header.add_list (Header.init ()) [
("authorization", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"access_token\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/oauth2/clients/:client_id/access-token/renew",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'access_token' => ''
]),
CURLOPT_HTTPHEADER => [
"authorization: {{apiKey}}",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew', [
'body' => '{
"access_token": ""
}',
'headers' => [
'authorization' => '{{apiKey}}',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/oauth2/clients/:client_id/access-token/renew');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'authorization' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'access_token' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'access_token' => ''
]));
$request->setRequestUrl('{{baseUrl}}/oauth2/clients/:client_id/access-token/renew');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'authorization' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"access_token": ""
}'
$headers=@{}
$headers.Add("authorization", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/oauth2/clients/:client_id/access-token/renew' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"access_token": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"access_token\": \"\"\n}"
headers = {
'authorization': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/oauth2/clients/:client_id/access-token/renew", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew"
payload = { "access_token": "" }
headers = {
"authorization": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew"
payload <- "{\n \"access_token\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('authorization' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/oauth2/clients/:client_id/access-token/renew")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"access_token\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/oauth2/clients/:client_id/access-token/renew') do |req|
req.headers['authorization'] = '{{apiKey}}'
req.body = "{\n \"access_token\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew";
let payload = json!({"access_token": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/oauth2/clients/:client_id/access-token/renew \
--header 'authorization: {{apiKey}}' \
--header 'content-type: application/json' \
--data '{
"access_token": ""
}'
echo '{
"access_token": ""
}' | \
http POST {{baseUrl}}/oauth2/clients/:client_id/access-token/renew \
authorization:'{{apiKey}}' \
content-type:application/json
wget --quiet \
--method POST \
--header 'authorization: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "access_token": ""\n}' \
--output-document \
- {{baseUrl}}/oauth2/clients/:client_id/access-token/renew
import Foundation
let headers = [
"authorization": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["access_token": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/oauth2/clients/:client_id/access-token/renew")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"access_token": "ACCESS_TOKEN",
"expires_at": "2006-01-02T15:04:05Z",
"merchant_id": "MERCHANT_ID",
"token_type": "bearer"
}
POST
RevokeToken
{{baseUrl}}/oauth2/revoke
HEADERS
Authorization
{{apiKey}}
BODY json
{
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/oauth2/revoke");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/oauth2/revoke" {:headers {:authorization "{{apiKey}}"}
:content-type :json
:form-params {:access_token ""
:client_id ""
:merchant_id ""
:revoke_only_access_token false}})
require "http/client"
url = "{{baseUrl}}/oauth2/revoke"
headers = HTTP::Headers{
"authorization" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/oauth2/revoke"),
Headers =
{
{ "authorization", "{{apiKey}}" },
},
Content = new StringContent("{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/oauth2/revoke");
var request = new RestRequest("", Method.Post);
request.AddHeader("authorization", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/oauth2/revoke"
payload := strings.NewReader("{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/oauth2/revoke HTTP/1.1
Authorization: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 101
{
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/oauth2/revoke")
.setHeader("authorization", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/oauth2/revoke"))
.header("authorization", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/oauth2/revoke")
.post(body)
.addHeader("authorization", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/oauth2/revoke")
.header("authorization", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}")
.asString();
const data = JSON.stringify({
access_token: '',
client_id: '',
merchant_id: '',
revoke_only_access_token: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/oauth2/revoke');
xhr.setRequestHeader('authorization', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/oauth2/revoke',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
data: {
access_token: '',
client_id: '',
merchant_id: '',
revoke_only_access_token: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/oauth2/revoke';
const options = {
method: 'POST',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
body: '{"access_token":"","client_id":"","merchant_id":"","revoke_only_access_token":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/oauth2/revoke',
method: 'POST',
headers: {
authorization: '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "access_token": "",\n "client_id": "",\n "merchant_id": "",\n "revoke_only_access_token": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/oauth2/revoke")
.post(body)
.addHeader("authorization", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/oauth2/revoke',
headers: {
authorization: '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
access_token: '',
client_id: '',
merchant_id: '',
revoke_only_access_token: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/oauth2/revoke',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
body: {
access_token: '',
client_id: '',
merchant_id: '',
revoke_only_access_token: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/oauth2/revoke');
req.headers({
authorization: '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
access_token: '',
client_id: '',
merchant_id: '',
revoke_only_access_token: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/oauth2/revoke',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
data: {
access_token: '',
client_id: '',
merchant_id: '',
revoke_only_access_token: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/oauth2/revoke';
const options = {
method: 'POST',
headers: {authorization: '{{apiKey}}', 'content-type': 'application/json'},
body: '{"access_token":"","client_id":"","merchant_id":"","revoke_only_access_token":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"access_token": @"",
@"client_id": @"",
@"merchant_id": @"",
@"revoke_only_access_token": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/oauth2/revoke"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/oauth2/revoke" in
let headers = Header.add_list (Header.init ()) [
("authorization", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/oauth2/revoke",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'access_token' => '',
'client_id' => '',
'merchant_id' => '',
'revoke_only_access_token' => null
]),
CURLOPT_HTTPHEADER => [
"authorization: {{apiKey}}",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/oauth2/revoke', [
'body' => '{
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
}',
'headers' => [
'authorization' => '{{apiKey}}',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/oauth2/revoke');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'authorization' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'access_token' => '',
'client_id' => '',
'merchant_id' => '',
'revoke_only_access_token' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'access_token' => '',
'client_id' => '',
'merchant_id' => '',
'revoke_only_access_token' => null
]));
$request->setRequestUrl('{{baseUrl}}/oauth2/revoke');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'authorization' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/oauth2/revoke' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
}'
$headers=@{}
$headers.Add("authorization", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/oauth2/revoke' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}"
headers = {
'authorization': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/oauth2/revoke", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/oauth2/revoke"
payload = {
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": False
}
headers = {
"authorization": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/oauth2/revoke"
payload <- "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('authorization' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/oauth2/revoke")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/oauth2/revoke') do |req|
req.headers['authorization'] = '{{apiKey}}'
req.body = "{\n \"access_token\": \"\",\n \"client_id\": \"\",\n \"merchant_id\": \"\",\n \"revoke_only_access_token\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/oauth2/revoke";
let payload = json!({
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/oauth2/revoke \
--header 'authorization: {{apiKey}}' \
--header 'content-type: application/json' \
--data '{
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
}'
echo '{
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
}' | \
http POST {{baseUrl}}/oauth2/revoke \
authorization:'{{apiKey}}' \
content-type:application/json
wget --quiet \
--method POST \
--header 'authorization: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "access_token": "",\n "client_id": "",\n "merchant_id": "",\n "revoke_only_access_token": false\n}' \
--output-document \
- {{baseUrl}}/oauth2/revoke
import Foundation
let headers = [
"authorization": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"access_token": "",
"client_id": "",
"merchant_id": "",
"revoke_only_access_token": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/oauth2/revoke")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"success": true
}
POST
BatchRetrieveOrders
{{baseUrl}}/v2/orders/batch-retrieve
BODY json
{
"location_id": "",
"order_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/orders/batch-retrieve");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"location_id\": \"\",\n \"order_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/orders/batch-retrieve" {:content-type :json
:form-params {:location_id ""
:order_ids []}})
require "http/client"
url = "{{baseUrl}}/v2/orders/batch-retrieve"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"location_id\": \"\",\n \"order_ids\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/orders/batch-retrieve"),
Content = new StringContent("{\n \"location_id\": \"\",\n \"order_ids\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/orders/batch-retrieve");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"location_id\": \"\",\n \"order_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/orders/batch-retrieve"
payload := strings.NewReader("{\n \"location_id\": \"\",\n \"order_ids\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/orders/batch-retrieve HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 42
{
"location_id": "",
"order_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/orders/batch-retrieve")
.setHeader("content-type", "application/json")
.setBody("{\n \"location_id\": \"\",\n \"order_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/orders/batch-retrieve"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"location_id\": \"\",\n \"order_ids\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"location_id\": \"\",\n \"order_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/orders/batch-retrieve")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/orders/batch-retrieve")
.header("content-type", "application/json")
.body("{\n \"location_id\": \"\",\n \"order_ids\": []\n}")
.asString();
const data = JSON.stringify({
location_id: '',
order_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/orders/batch-retrieve');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/batch-retrieve',
headers: {'content-type': 'application/json'},
data: {location_id: '', order_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/orders/batch-retrieve';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"location_id":"","order_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/orders/batch-retrieve',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "location_id": "",\n "order_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"location_id\": \"\",\n \"order_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/orders/batch-retrieve")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/orders/batch-retrieve',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({location_id: '', order_ids: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/batch-retrieve',
headers: {'content-type': 'application/json'},
body: {location_id: '', order_ids: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/orders/batch-retrieve');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
location_id: '',
order_ids: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/batch-retrieve',
headers: {'content-type': 'application/json'},
data: {location_id: '', order_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/orders/batch-retrieve';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"location_id":"","order_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"location_id": @"",
@"order_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/orders/batch-retrieve"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/orders/batch-retrieve" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"location_id\": \"\",\n \"order_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/orders/batch-retrieve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location_id' => '',
'order_ids' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/orders/batch-retrieve', [
'body' => '{
"location_id": "",
"order_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/orders/batch-retrieve');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'location_id' => '',
'order_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'location_id' => '',
'order_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/orders/batch-retrieve');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/orders/batch-retrieve' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"location_id": "",
"order_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/orders/batch-retrieve' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"location_id": "",
"order_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"location_id\": \"\",\n \"order_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/orders/batch-retrieve", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/orders/batch-retrieve"
payload = {
"location_id": "",
"order_ids": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/orders/batch-retrieve"
payload <- "{\n \"location_id\": \"\",\n \"order_ids\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/orders/batch-retrieve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"location_id\": \"\",\n \"order_ids\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/orders/batch-retrieve') do |req|
req.body = "{\n \"location_id\": \"\",\n \"order_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/orders/batch-retrieve";
let payload = json!({
"location_id": "",
"order_ids": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/orders/batch-retrieve \
--header 'content-type: application/json' \
--data '{
"location_id": "",
"order_ids": []
}'
echo '{
"location_id": "",
"order_ids": []
}' | \
http POST {{baseUrl}}/v2/orders/batch-retrieve \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "location_id": "",\n "order_ids": []\n}' \
--output-document \
- {{baseUrl}}/v2/orders/batch-retrieve
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"location_id": "",
"order_ids": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/orders/batch-retrieve")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"orders": [
{
"id": "CAISEM82RcpmcFBM0TfOyiHV3es",
"line_items": [
{
"base_price_money": {
"amount": 1599,
"currency": "USD"
},
"name": "Awesome product",
"quantity": "1",
"total_money": {
"amount": 1599,
"currency": "USD"
},
"uid": "945986d1-9586-11e6-ad5a-28cfe92138cf"
},
{
"base_price_money": {
"amount": 2000,
"currency": "USD"
},
"name": "Another awesome product",
"quantity": "3",
"total_money": {
"amount": 6000,
"currency": "USD"
},
"uid": "a8f4168c-9586-11e6-bdf0-28cfe92138cf"
}
],
"location_id": "057P5VYJ4A5X1",
"reference_id": "my-order-001",
"total_money": {
"amount": 7599,
"currency": "USD"
}
}
]
}
POST
CalculateOrder
{{baseUrl}}/v2/orders/calculate
BODY json
{
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
},
"proposed_rewards": [
{}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/orders/calculate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/orders/calculate" {:content-type :json
:form-params {:order {:closed_at ""
:created_at ""
:customer_id ""
:discounts [{:amount_money {:amount 0
:currency ""}
:applied_money {}
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:pricing_rule_id ""
:reward_ids []
:scope ""
:type ""
:uid ""}]
:fulfillments [{:metadata {}
:pickup_details {:accepted_at ""
:auto_complete_duration ""
:cancel_reason ""
:canceled_at ""
:curbside_pickup_details {:buyer_arrived_at ""
:curbside_details ""}
:expired_at ""
:expires_at ""
:is_curbside_pickup false
:note ""
:picked_up_at ""
:pickup_at ""
:pickup_window_duration ""
:placed_at ""
:prep_time_duration ""
:ready_at ""
:recipient {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:customer_id ""
:display_name ""
:email_address ""
:phone_number ""}
:rejected_at ""
:schedule_type ""}
:shipment_details {:cancel_reason ""
:canceled_at ""
:carrier ""
:expected_shipped_at ""
:failed_at ""
:failure_reason ""
:in_progress_at ""
:packaged_at ""
:placed_at ""
:recipient {}
:shipped_at ""
:shipping_note ""
:shipping_type ""
:tracking_number ""
:tracking_url ""}
:state ""
:type ""
:uid ""}]
:id ""
:line_items [{:applied_discounts [{:applied_money {}
:discount_uid ""
:uid ""}]
:applied_taxes [{:applied_money {}
:tax_uid ""
:uid ""}]
:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:gross_sales_money {}
:item_type ""
:metadata {}
:modifiers [{:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:total_price_money {}
:uid ""}]
:name ""
:note ""
:pricing_blocklists {:blocked_discounts [{:discount_catalog_object_id ""
:discount_uid ""
:uid ""}]
:blocked_taxes [{:tax_catalog_object_id ""
:tax_uid ""
:uid ""}]}
:quantity ""
:quantity_unit {:catalog_version 0
:measurement_unit {:area_unit ""
:custom_unit {:abbreviation ""
:name ""}
:generic_unit ""
:length_unit ""
:time_unit ""
:type ""
:volume_unit ""
:weight_unit ""}
:precision 0}
:total_discount_money {}
:total_money {}
:total_tax_money {}
:uid ""
:variation_name ""
:variation_total_price_money {}}]
:location_id ""
:metadata {}
:net_amounts {:discount_money {}
:service_charge_money {}
:tax_money {}
:tip_money {}
:total_money {}}
:pricing_options {:auto_apply_discounts false
:auto_apply_taxes false}
:reference_id ""
:refunds [{:additional_recipients [{:amount_money {}
:description ""
:location_id ""
:receivable_id ""}]
:amount_money {}
:created_at ""
:id ""
:location_id ""
:processing_fee_money {}
:reason ""
:status ""
:tender_id ""
:transaction_id ""}]
:return_amounts {}
:returns [{:return_amounts {}
:return_discounts [{:amount_money {}
:applied_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:scope ""
:source_discount_uid ""
:type ""
:uid ""}]
:return_line_items [{:applied_discounts [{}]
:applied_taxes [{}]
:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:gross_return_money {}
:item_type ""
:name ""
:note ""
:quantity ""
:quantity_unit {}
:return_modifiers [{:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:source_modifier_uid ""
:total_price_money {}
:uid ""}]
:source_line_item_uid ""
:total_discount_money {}
:total_money {}
:total_tax_money {}
:uid ""
:variation_name ""
:variation_total_price_money {}}]
:return_service_charges [{:amount_money {}
:applied_money {}
:applied_taxes [{}]
:calculation_phase ""
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:source_service_charge_uid ""
:taxable false
:total_money {}
:total_tax_money {}
:uid ""}]
:return_taxes [{:applied_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:scope ""
:source_tax_uid ""
:type ""
:uid ""}]
:rounding_adjustment {:amount_money {}
:name ""
:uid ""}
:source_order_id ""
:uid ""}]
:rewards [{:id ""
:reward_tier_id ""}]
:rounding_adjustment {}
:service_charges [{:amount_money {}
:applied_money {}
:applied_taxes [{}]
:calculation_phase ""
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:taxable false
:total_money {}
:total_tax_money {}
:type ""
:uid ""}]
:source {:name ""}
:state ""
:taxes [{:applied_money {}
:auto_applied false
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:scope ""
:type ""
:uid ""}]
:tenders [{:additional_recipients [{}]
:amount_money {}
:card_details {:card {:billing_address {}
:bin ""
:card_brand ""
:card_type ""
:cardholder_name ""
:customer_id ""
:enabled false
:exp_month 0
:exp_year 0
:fingerprint ""
:id ""
:last_4 ""
:prepaid_type ""
:reference_id ""
:version 0}
:entry_method ""
:status ""}
:cash_details {:buyer_tendered_money {}
:change_back_money {}}
:created_at ""
:customer_id ""
:id ""
:location_id ""
:note ""
:payment_id ""
:processing_fee_money {}
:tip_money {}
:transaction_id ""
:type ""}]
:total_discount_money {}
:total_money {}
:total_service_charge_money {}
:total_tax_money {}
:total_tip_money {}
:updated_at ""
:version 0}
:proposed_rewards [{}]}})
require "http/client"
url = "{{baseUrl}}/v2/orders/calculate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/orders/calculate"),
Content = new StringContent("{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/orders/calculate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/orders/calculate"
payload := strings.NewReader("{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/orders/calculate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 9906
{
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
},
"proposed_rewards": [
{}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/orders/calculate")
.setHeader("content-type", "application/json")
.setBody("{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/orders/calculate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/orders/calculate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/orders/calculate")
.header("content-type", "application/json")
.body("{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}")
.asString();
const data = JSON.stringify({
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {
amount: 0,
currency: ''
},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {
buyer_arrived_at: '',
curbside_details: ''
},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [
{
applied_money: {},
discount_uid: '',
uid: ''
}
],
applied_taxes: [
{
applied_money: {},
tax_uid: '',
uid: ''
}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [
{
discount_catalog_object_id: '',
discount_uid: '',
uid: ''
}
],
blocked_taxes: [
{
tax_catalog_object_id: '',
tax_uid: '',
uid: ''
}
]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {
auto_apply_discounts: false,
auto_apply_taxes: false
},
reference_id: '',
refunds: [
{
additional_recipients: [
{
amount_money: {},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [
{}
],
applied_taxes: [
{}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {
amount_money: {},
name: '',
uid: ''
},
source_order_id: '',
uid: ''
}
],
rewards: [
{
id: '',
reward_tier_id: ''
}
],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {
name: ''
},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [
{}
],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {
buyer_tendered_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
},
proposed_rewards: [
{}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/orders/calculate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/calculate',
headers: {'content-type': 'application/json'},
data: {
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
},
proposed_rewards: [{}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/orders/calculate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"order":{"closed_at":"","created_at":"","customer_id":"","discounts":[{"amount_money":{"amount":0,"currency":""},"applied_money":{},"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","pricing_rule_id":"","reward_ids":[],"scope":"","type":"","uid":""}],"fulfillments":[{"metadata":{},"pickup_details":{"accepted_at":"","auto_complete_duration":"","cancel_reason":"","canceled_at":"","curbside_pickup_details":{"buyer_arrived_at":"","curbside_details":""},"expired_at":"","expires_at":"","is_curbside_pickup":false,"note":"","picked_up_at":"","pickup_at":"","pickup_window_duration":"","placed_at":"","prep_time_duration":"","ready_at":"","recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"customer_id":"","display_name":"","email_address":"","phone_number":""},"rejected_at":"","schedule_type":""},"shipment_details":{"cancel_reason":"","canceled_at":"","carrier":"","expected_shipped_at":"","failed_at":"","failure_reason":"","in_progress_at":"","packaged_at":"","placed_at":"","recipient":{},"shipped_at":"","shipping_note":"","shipping_type":"","tracking_number":"","tracking_url":""},"state":"","type":"","uid":""}],"id":"","line_items":[{"applied_discounts":[{"applied_money":{},"discount_uid":"","uid":""}],"applied_taxes":[{"applied_money":{},"tax_uid":"","uid":""}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_sales_money":{},"item_type":"","metadata":{},"modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","total_price_money":{},"uid":""}],"name":"","note":"","pricing_blocklists":{"blocked_discounts":[{"discount_catalog_object_id":"","discount_uid":"","uid":""}],"blocked_taxes":[{"tax_catalog_object_id":"","tax_uid":"","uid":""}]},"quantity":"","quantity_unit":{"catalog_version":0,"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"location_id":"","metadata":{},"net_amounts":{"discount_money":{},"service_charge_money":{},"tax_money":{},"tip_money":{},"total_money":{}},"pricing_options":{"auto_apply_discounts":false,"auto_apply_taxes":false},"reference_id":"","refunds":[{"additional_recipients":[{"amount_money":{},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"created_at":"","id":"","location_id":"","processing_fee_money":{},"reason":"","status":"","tender_id":"","transaction_id":""}],"return_amounts":{},"returns":[{"return_amounts":{},"return_discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_discount_uid":"","type":"","uid":""}],"return_line_items":[{"applied_discounts":[{}],"applied_taxes":[{}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_return_money":{},"item_type":"","name":"","note":"","quantity":"","quantity_unit":{},"return_modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","source_modifier_uid":"","total_price_money":{},"uid":""}],"source_line_item_uid":"","total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"return_service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"name":"","percentage":"","source_service_charge_uid":"","taxable":false,"total_money":{},"total_tax_money":{},"uid":""}],"return_taxes":[{"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_tax_uid":"","type":"","uid":""}],"rounding_adjustment":{"amount_money":{},"name":"","uid":""},"source_order_id":"","uid":""}],"rewards":[{"id":"","reward_tier_id":""}],"rounding_adjustment":{},"service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","taxable":false,"total_money":{},"total_tax_money":{},"type":"","uid":""}],"source":{"name":""},"state":"","taxes":[{"applied_money":{},"auto_applied":false,"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","scope":"","type":"","uid":""}],"tenders":[{"additional_recipients":[{}],"amount_money":{},"card_details":{"card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"entry_method":"","status":""},"cash_details":{"buyer_tendered_money":{},"change_back_money":{}},"created_at":"","customer_id":"","id":"","location_id":"","note":"","payment_id":"","processing_fee_money":{},"tip_money":{},"transaction_id":"","type":""}],"total_discount_money":{},"total_money":{},"total_service_charge_money":{},"total_tax_money":{},"total_tip_money":{},"updated_at":"","version":0},"proposed_rewards":[{}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/orders/calculate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "order": {\n "closed_at": "",\n "created_at": "",\n "customer_id": "",\n "discounts": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "pricing_rule_id": "",\n "reward_ids": [],\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "fulfillments": [\n {\n "metadata": {},\n "pickup_details": {\n "accepted_at": "",\n "auto_complete_duration": "",\n "cancel_reason": "",\n "canceled_at": "",\n "curbside_pickup_details": {\n "buyer_arrived_at": "",\n "curbside_details": ""\n },\n "expired_at": "",\n "expires_at": "",\n "is_curbside_pickup": false,\n "note": "",\n "picked_up_at": "",\n "pickup_at": "",\n "pickup_window_duration": "",\n "placed_at": "",\n "prep_time_duration": "",\n "ready_at": "",\n "recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "customer_id": "",\n "display_name": "",\n "email_address": "",\n "phone_number": ""\n },\n "rejected_at": "",\n "schedule_type": ""\n },\n "shipment_details": {\n "cancel_reason": "",\n "canceled_at": "",\n "carrier": "",\n "expected_shipped_at": "",\n "failed_at": "",\n "failure_reason": "",\n "in_progress_at": "",\n "packaged_at": "",\n "placed_at": "",\n "recipient": {},\n "shipped_at": "",\n "shipping_note": "",\n "shipping_type": "",\n "tracking_number": "",\n "tracking_url": ""\n },\n "state": "",\n "type": "",\n "uid": ""\n }\n ],\n "id": "",\n "line_items": [\n {\n "applied_discounts": [\n {\n "applied_money": {},\n "discount_uid": "",\n "uid": ""\n }\n ],\n "applied_taxes": [\n {\n "applied_money": {},\n "tax_uid": "",\n "uid": ""\n }\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_sales_money": {},\n "item_type": "",\n "metadata": {},\n "modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "name": "",\n "note": "",\n "pricing_blocklists": {\n "blocked_discounts": [\n {\n "discount_catalog_object_id": "",\n "discount_uid": "",\n "uid": ""\n }\n ],\n "blocked_taxes": [\n {\n "tax_catalog_object_id": "",\n "tax_uid": "",\n "uid": ""\n }\n ]\n },\n "quantity": "",\n "quantity_unit": {\n "catalog_version": 0,\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "location_id": "",\n "metadata": {},\n "net_amounts": {\n "discount_money": {},\n "service_charge_money": {},\n "tax_money": {},\n "tip_money": {},\n "total_money": {}\n },\n "pricing_options": {\n "auto_apply_discounts": false,\n "auto_apply_taxes": false\n },\n "reference_id": "",\n "refunds": [\n {\n "additional_recipients": [\n {\n "amount_money": {},\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "created_at": "",\n "id": "",\n "location_id": "",\n "processing_fee_money": {},\n "reason": "",\n "status": "",\n "tender_id": "",\n "transaction_id": ""\n }\n ],\n "return_amounts": {},\n "returns": [\n {\n "return_amounts": {},\n "return_discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_discount_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "return_line_items": [\n {\n "applied_discounts": [\n {}\n ],\n "applied_taxes": [\n {}\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_return_money": {},\n "item_type": "",\n "name": "",\n "note": "",\n "quantity": "",\n "quantity_unit": {},\n "return_modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "source_modifier_uid": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "source_line_item_uid": "",\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "return_service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "source_service_charge_uid": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "uid": ""\n }\n ],\n "return_taxes": [\n {\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_tax_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "rounding_adjustment": {\n "amount_money": {},\n "name": "",\n "uid": ""\n },\n "source_order_id": "",\n "uid": ""\n }\n ],\n "rewards": [\n {\n "id": "",\n "reward_tier_id": ""\n }\n ],\n "rounding_adjustment": {},\n "service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "type": "",\n "uid": ""\n }\n ],\n "source": {\n "name": ""\n },\n "state": "",\n "taxes": [\n {\n "applied_money": {},\n "auto_applied": false,\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "tenders": [\n {\n "additional_recipients": [\n {}\n ],\n "amount_money": {},\n "card_details": {\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "entry_method": "",\n "status": ""\n },\n "cash_details": {\n "buyer_tendered_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "id": "",\n "location_id": "",\n "note": "",\n "payment_id": "",\n "processing_fee_money": {},\n "tip_money": {},\n "transaction_id": "",\n "type": ""\n }\n ],\n "total_discount_money": {},\n "total_money": {},\n "total_service_charge_money": {},\n "total_tax_money": {},\n "total_tip_money": {},\n "updated_at": "",\n "version": 0\n },\n "proposed_rewards": [\n {}\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/orders/calculate")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/orders/calculate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
},
proposed_rewards: [{}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/calculate',
headers: {'content-type': 'application/json'},
body: {
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
},
proposed_rewards: [{}]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/orders/calculate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {
amount: 0,
currency: ''
},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {
buyer_arrived_at: '',
curbside_details: ''
},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [
{
applied_money: {},
discount_uid: '',
uid: ''
}
],
applied_taxes: [
{
applied_money: {},
tax_uid: '',
uid: ''
}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [
{
discount_catalog_object_id: '',
discount_uid: '',
uid: ''
}
],
blocked_taxes: [
{
tax_catalog_object_id: '',
tax_uid: '',
uid: ''
}
]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {
auto_apply_discounts: false,
auto_apply_taxes: false
},
reference_id: '',
refunds: [
{
additional_recipients: [
{
amount_money: {},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [
{}
],
applied_taxes: [
{}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {
amount_money: {},
name: '',
uid: ''
},
source_order_id: '',
uid: ''
}
],
rewards: [
{
id: '',
reward_tier_id: ''
}
],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {
name: ''
},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [
{}
],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {
buyer_tendered_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
},
proposed_rewards: [
{}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/calculate',
headers: {'content-type': 'application/json'},
data: {
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
},
proposed_rewards: [{}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/orders/calculate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"order":{"closed_at":"","created_at":"","customer_id":"","discounts":[{"amount_money":{"amount":0,"currency":""},"applied_money":{},"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","pricing_rule_id":"","reward_ids":[],"scope":"","type":"","uid":""}],"fulfillments":[{"metadata":{},"pickup_details":{"accepted_at":"","auto_complete_duration":"","cancel_reason":"","canceled_at":"","curbside_pickup_details":{"buyer_arrived_at":"","curbside_details":""},"expired_at":"","expires_at":"","is_curbside_pickup":false,"note":"","picked_up_at":"","pickup_at":"","pickup_window_duration":"","placed_at":"","prep_time_duration":"","ready_at":"","recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"customer_id":"","display_name":"","email_address":"","phone_number":""},"rejected_at":"","schedule_type":""},"shipment_details":{"cancel_reason":"","canceled_at":"","carrier":"","expected_shipped_at":"","failed_at":"","failure_reason":"","in_progress_at":"","packaged_at":"","placed_at":"","recipient":{},"shipped_at":"","shipping_note":"","shipping_type":"","tracking_number":"","tracking_url":""},"state":"","type":"","uid":""}],"id":"","line_items":[{"applied_discounts":[{"applied_money":{},"discount_uid":"","uid":""}],"applied_taxes":[{"applied_money":{},"tax_uid":"","uid":""}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_sales_money":{},"item_type":"","metadata":{},"modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","total_price_money":{},"uid":""}],"name":"","note":"","pricing_blocklists":{"blocked_discounts":[{"discount_catalog_object_id":"","discount_uid":"","uid":""}],"blocked_taxes":[{"tax_catalog_object_id":"","tax_uid":"","uid":""}]},"quantity":"","quantity_unit":{"catalog_version":0,"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"location_id":"","metadata":{},"net_amounts":{"discount_money":{},"service_charge_money":{},"tax_money":{},"tip_money":{},"total_money":{}},"pricing_options":{"auto_apply_discounts":false,"auto_apply_taxes":false},"reference_id":"","refunds":[{"additional_recipients":[{"amount_money":{},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"created_at":"","id":"","location_id":"","processing_fee_money":{},"reason":"","status":"","tender_id":"","transaction_id":""}],"return_amounts":{},"returns":[{"return_amounts":{},"return_discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_discount_uid":"","type":"","uid":""}],"return_line_items":[{"applied_discounts":[{}],"applied_taxes":[{}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_return_money":{},"item_type":"","name":"","note":"","quantity":"","quantity_unit":{},"return_modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","source_modifier_uid":"","total_price_money":{},"uid":""}],"source_line_item_uid":"","total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"return_service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"name":"","percentage":"","source_service_charge_uid":"","taxable":false,"total_money":{},"total_tax_money":{},"uid":""}],"return_taxes":[{"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_tax_uid":"","type":"","uid":""}],"rounding_adjustment":{"amount_money":{},"name":"","uid":""},"source_order_id":"","uid":""}],"rewards":[{"id":"","reward_tier_id":""}],"rounding_adjustment":{},"service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","taxable":false,"total_money":{},"total_tax_money":{},"type":"","uid":""}],"source":{"name":""},"state":"","taxes":[{"applied_money":{},"auto_applied":false,"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","scope":"","type":"","uid":""}],"tenders":[{"additional_recipients":[{}],"amount_money":{},"card_details":{"card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"entry_method":"","status":""},"cash_details":{"buyer_tendered_money":{},"change_back_money":{}},"created_at":"","customer_id":"","id":"","location_id":"","note":"","payment_id":"","processing_fee_money":{},"tip_money":{},"transaction_id":"","type":""}],"total_discount_money":{},"total_money":{},"total_service_charge_money":{},"total_tax_money":{},"total_tip_money":{},"updated_at":"","version":0},"proposed_rewards":[{}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"order": @{ @"closed_at": @"", @"created_at": @"", @"customer_id": @"", @"discounts": @[ @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"pricing_rule_id": @"", @"reward_ids": @[ ], @"scope": @"", @"type": @"", @"uid": @"" } ], @"fulfillments": @[ @{ @"metadata": @{ }, @"pickup_details": @{ @"accepted_at": @"", @"auto_complete_duration": @"", @"cancel_reason": @"", @"canceled_at": @"", @"curbside_pickup_details": @{ @"buyer_arrived_at": @"", @"curbside_details": @"" }, @"expired_at": @"", @"expires_at": @"", @"is_curbside_pickup": @NO, @"note": @"", @"picked_up_at": @"", @"pickup_at": @"", @"pickup_window_duration": @"", @"placed_at": @"", @"prep_time_duration": @"", @"ready_at": @"", @"recipient": @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"customer_id": @"", @"display_name": @"", @"email_address": @"", @"phone_number": @"" }, @"rejected_at": @"", @"schedule_type": @"" }, @"shipment_details": @{ @"cancel_reason": @"", @"canceled_at": @"", @"carrier": @"", @"expected_shipped_at": @"", @"failed_at": @"", @"failure_reason": @"", @"in_progress_at": @"", @"packaged_at": @"", @"placed_at": @"", @"recipient": @{ }, @"shipped_at": @"", @"shipping_note": @"", @"shipping_type": @"", @"tracking_number": @"", @"tracking_url": @"" }, @"state": @"", @"type": @"", @"uid": @"" } ], @"id": @"", @"line_items": @[ @{ @"applied_discounts": @[ @{ @"applied_money": @{ }, @"discount_uid": @"", @"uid": @"" } ], @"applied_taxes": @[ @{ @"applied_money": @{ }, @"tax_uid": @"", @"uid": @"" } ], @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"gross_sales_money": @{ }, @"item_type": @"", @"metadata": @{ }, @"modifiers": @[ @{ @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"total_price_money": @{ }, @"uid": @"" } ], @"name": @"", @"note": @"", @"pricing_blocklists": @{ @"blocked_discounts": @[ @{ @"discount_catalog_object_id": @"", @"discount_uid": @"", @"uid": @"" } ], @"blocked_taxes": @[ @{ @"tax_catalog_object_id": @"", @"tax_uid": @"", @"uid": @"" } ] }, @"quantity": @"", @"quantity_unit": @{ @"catalog_version": @0, @"measurement_unit": @{ @"area_unit": @"", @"custom_unit": @{ @"abbreviation": @"", @"name": @"" }, @"generic_unit": @"", @"length_unit": @"", @"time_unit": @"", @"type": @"", @"volume_unit": @"", @"weight_unit": @"" }, @"precision": @0 }, @"total_discount_money": @{ }, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"", @"variation_name": @"", @"variation_total_price_money": @{ } } ], @"location_id": @"", @"metadata": @{ }, @"net_amounts": @{ @"discount_money": @{ }, @"service_charge_money": @{ }, @"tax_money": @{ }, @"tip_money": @{ }, @"total_money": @{ } }, @"pricing_options": @{ @"auto_apply_discounts": @NO, @"auto_apply_taxes": @NO }, @"reference_id": @"", @"refunds": @[ @{ @"additional_recipients": @[ @{ @"amount_money": @{ }, @"description": @"", @"location_id": @"", @"receivable_id": @"" } ], @"amount_money": @{ }, @"created_at": @"", @"id": @"", @"location_id": @"", @"processing_fee_money": @{ }, @"reason": @"", @"status": @"", @"tender_id": @"", @"transaction_id": @"" } ], @"return_amounts": @{ }, @"returns": @[ @{ @"return_amounts": @{ }, @"return_discounts": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"scope": @"", @"source_discount_uid": @"", @"type": @"", @"uid": @"" } ], @"return_line_items": @[ @{ @"applied_discounts": @[ @{ } ], @"applied_taxes": @[ @{ } ], @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"gross_return_money": @{ }, @"item_type": @"", @"name": @"", @"note": @"", @"quantity": @"", @"quantity_unit": @{ }, @"return_modifiers": @[ @{ @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"source_modifier_uid": @"", @"total_price_money": @{ }, @"uid": @"" } ], @"source_line_item_uid": @"", @"total_discount_money": @{ }, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"", @"variation_name": @"", @"variation_total_price_money": @{ } } ], @"return_service_charges": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"applied_taxes": @[ @{ } ], @"calculation_phase": @"", @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"source_service_charge_uid": @"", @"taxable": @NO, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"" } ], @"return_taxes": @[ @{ @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"scope": @"", @"source_tax_uid": @"", @"type": @"", @"uid": @"" } ], @"rounding_adjustment": @{ @"amount_money": @{ }, @"name": @"", @"uid": @"" }, @"source_order_id": @"", @"uid": @"" } ], @"rewards": @[ @{ @"id": @"", @"reward_tier_id": @"" } ], @"rounding_adjustment": @{ }, @"service_charges": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"applied_taxes": @[ @{ } ], @"calculation_phase": @"", @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"taxable": @NO, @"total_money": @{ }, @"total_tax_money": @{ }, @"type": @"", @"uid": @"" } ], @"source": @{ @"name": @"" }, @"state": @"", @"taxes": @[ @{ @"applied_money": @{ }, @"auto_applied": @NO, @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"scope": @"", @"type": @"", @"uid": @"" } ], @"tenders": @[ @{ @"additional_recipients": @[ @{ } ], @"amount_money": @{ }, @"card_details": @{ @"card": @{ @"billing_address": @{ }, @"bin": @"", @"card_brand": @"", @"card_type": @"", @"cardholder_name": @"", @"customer_id": @"", @"enabled": @NO, @"exp_month": @0, @"exp_year": @0, @"fingerprint": @"", @"id": @"", @"last_4": @"", @"prepaid_type": @"", @"reference_id": @"", @"version": @0 }, @"entry_method": @"", @"status": @"" }, @"cash_details": @{ @"buyer_tendered_money": @{ }, @"change_back_money": @{ } }, @"created_at": @"", @"customer_id": @"", @"id": @"", @"location_id": @"", @"note": @"", @"payment_id": @"", @"processing_fee_money": @{ }, @"tip_money": @{ }, @"transaction_id": @"", @"type": @"" } ], @"total_discount_money": @{ }, @"total_money": @{ }, @"total_service_charge_money": @{ }, @"total_tax_money": @{ }, @"total_tip_money": @{ }, @"updated_at": @"", @"version": @0 },
@"proposed_rewards": @[ @{ } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/orders/calculate"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/orders/calculate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/orders/calculate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
],
'proposed_rewards' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/orders/calculate', [
'body' => '{
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
},
"proposed_rewards": [
{}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/orders/calculate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
],
'proposed_rewards' => [
[
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
],
'proposed_rewards' => [
[
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/orders/calculate');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/orders/calculate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
},
"proposed_rewards": [
{}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/orders/calculate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
},
"proposed_rewards": [
{}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/orders/calculate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/orders/calculate"
payload = {
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": False,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": False,
"auto_apply_taxes": False
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [{}],
"applied_taxes": [{}],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [{}],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": False,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [{}],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": False,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": { "name": "" },
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": False,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [{}],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": False,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
},
"proposed_rewards": [{}]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/orders/calculate"
payload <- "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/orders/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/orders/calculate') do |req|
req.body = "{\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n },\n \"proposed_rewards\": [\n {}\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/orders/calculate";
let payload = json!({
"order": json!({
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": (
json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": (),
"scope": "",
"type": "",
"uid": ""
})
),
"fulfillments": (
json!({
"metadata": json!({}),
"pickup_details": json!({
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": json!({
"buyer_arrived_at": "",
"curbside_details": ""
}),
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
}),
"rejected_at": "",
"schedule_type": ""
}),
"shipment_details": json!({
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": json!({}),
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
}),
"state": "",
"type": "",
"uid": ""
})
),
"id": "",
"line_items": (
json!({
"applied_discounts": (
json!({
"applied_money": json!({}),
"discount_uid": "",
"uid": ""
})
),
"applied_taxes": (
json!({
"applied_money": json!({}),
"tax_uid": "",
"uid": ""
})
),
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": json!({}),
"item_type": "",
"metadata": json!({}),
"modifiers": (
json!({
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": json!({}),
"uid": ""
})
),
"name": "",
"note": "",
"pricing_blocklists": json!({
"blocked_discounts": (
json!({
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
})
),
"blocked_taxes": (
json!({
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
})
)
}),
"quantity": "",
"quantity_unit": json!({
"catalog_version": 0,
"measurement_unit": json!({
"area_unit": "",
"custom_unit": json!({
"abbreviation": "",
"name": ""
}),
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
}),
"precision": 0
}),
"total_discount_money": json!({}),
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": "",
"variation_name": "",
"variation_total_price_money": json!({})
})
),
"location_id": "",
"metadata": json!({}),
"net_amounts": json!({
"discount_money": json!({}),
"service_charge_money": json!({}),
"tax_money": json!({}),
"tip_money": json!({}),
"total_money": json!({})
}),
"pricing_options": json!({
"auto_apply_discounts": false,
"auto_apply_taxes": false
}),
"reference_id": "",
"refunds": (
json!({
"additional_recipients": (
json!({
"amount_money": json!({}),
"description": "",
"location_id": "",
"receivable_id": ""
})
),
"amount_money": json!({}),
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": json!({}),
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
})
),
"return_amounts": json!({}),
"returns": (
json!({
"return_amounts": json!({}),
"return_discounts": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
})
),
"return_line_items": (
json!({
"applied_discounts": (json!({})),
"applied_taxes": (json!({})),
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": json!({}),
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": json!({}),
"return_modifiers": (
json!({
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": json!({}),
"uid": ""
})
),
"source_line_item_uid": "",
"total_discount_money": json!({}),
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": "",
"variation_name": "",
"variation_total_price_money": json!({})
})
),
"return_service_charges": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"applied_taxes": (json!({})),
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": ""
})
),
"return_taxes": (
json!({
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
})
),
"rounding_adjustment": json!({
"amount_money": json!({}),
"name": "",
"uid": ""
}),
"source_order_id": "",
"uid": ""
})
),
"rewards": (
json!({
"id": "",
"reward_tier_id": ""
})
),
"rounding_adjustment": json!({}),
"service_charges": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"applied_taxes": (json!({})),
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"taxable": false,
"total_money": json!({}),
"total_tax_money": json!({}),
"type": "",
"uid": ""
})
),
"source": json!({"name": ""}),
"state": "",
"taxes": (
json!({
"applied_money": json!({}),
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
})
),
"tenders": (
json!({
"additional_recipients": (json!({})),
"amount_money": json!({}),
"card_details": json!({
"card": json!({
"billing_address": json!({}),
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
}),
"entry_method": "",
"status": ""
}),
"cash_details": json!({
"buyer_tendered_money": json!({}),
"change_back_money": json!({})
}),
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": json!({}),
"tip_money": json!({}),
"transaction_id": "",
"type": ""
})
),
"total_discount_money": json!({}),
"total_money": json!({}),
"total_service_charge_money": json!({}),
"total_tax_money": json!({}),
"total_tip_money": json!({}),
"updated_at": "",
"version": 0
}),
"proposed_rewards": (json!({}))
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/orders/calculate \
--header 'content-type: application/json' \
--data '{
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
},
"proposed_rewards": [
{}
]
}'
echo '{
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
},
"proposed_rewards": [
{}
]
}' | \
http POST {{baseUrl}}/v2/orders/calculate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "order": {\n "closed_at": "",\n "created_at": "",\n "customer_id": "",\n "discounts": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "pricing_rule_id": "",\n "reward_ids": [],\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "fulfillments": [\n {\n "metadata": {},\n "pickup_details": {\n "accepted_at": "",\n "auto_complete_duration": "",\n "cancel_reason": "",\n "canceled_at": "",\n "curbside_pickup_details": {\n "buyer_arrived_at": "",\n "curbside_details": ""\n },\n "expired_at": "",\n "expires_at": "",\n "is_curbside_pickup": false,\n "note": "",\n "picked_up_at": "",\n "pickup_at": "",\n "pickup_window_duration": "",\n "placed_at": "",\n "prep_time_duration": "",\n "ready_at": "",\n "recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "customer_id": "",\n "display_name": "",\n "email_address": "",\n "phone_number": ""\n },\n "rejected_at": "",\n "schedule_type": ""\n },\n "shipment_details": {\n "cancel_reason": "",\n "canceled_at": "",\n "carrier": "",\n "expected_shipped_at": "",\n "failed_at": "",\n "failure_reason": "",\n "in_progress_at": "",\n "packaged_at": "",\n "placed_at": "",\n "recipient": {},\n "shipped_at": "",\n "shipping_note": "",\n "shipping_type": "",\n "tracking_number": "",\n "tracking_url": ""\n },\n "state": "",\n "type": "",\n "uid": ""\n }\n ],\n "id": "",\n "line_items": [\n {\n "applied_discounts": [\n {\n "applied_money": {},\n "discount_uid": "",\n "uid": ""\n }\n ],\n "applied_taxes": [\n {\n "applied_money": {},\n "tax_uid": "",\n "uid": ""\n }\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_sales_money": {},\n "item_type": "",\n "metadata": {},\n "modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "name": "",\n "note": "",\n "pricing_blocklists": {\n "blocked_discounts": [\n {\n "discount_catalog_object_id": "",\n "discount_uid": "",\n "uid": ""\n }\n ],\n "blocked_taxes": [\n {\n "tax_catalog_object_id": "",\n "tax_uid": "",\n "uid": ""\n }\n ]\n },\n "quantity": "",\n "quantity_unit": {\n "catalog_version": 0,\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "location_id": "",\n "metadata": {},\n "net_amounts": {\n "discount_money": {},\n "service_charge_money": {},\n "tax_money": {},\n "tip_money": {},\n "total_money": {}\n },\n "pricing_options": {\n "auto_apply_discounts": false,\n "auto_apply_taxes": false\n },\n "reference_id": "",\n "refunds": [\n {\n "additional_recipients": [\n {\n "amount_money": {},\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "created_at": "",\n "id": "",\n "location_id": "",\n "processing_fee_money": {},\n "reason": "",\n "status": "",\n "tender_id": "",\n "transaction_id": ""\n }\n ],\n "return_amounts": {},\n "returns": [\n {\n "return_amounts": {},\n "return_discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_discount_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "return_line_items": [\n {\n "applied_discounts": [\n {}\n ],\n "applied_taxes": [\n {}\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_return_money": {},\n "item_type": "",\n "name": "",\n "note": "",\n "quantity": "",\n "quantity_unit": {},\n "return_modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "source_modifier_uid": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "source_line_item_uid": "",\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "return_service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "source_service_charge_uid": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "uid": ""\n }\n ],\n "return_taxes": [\n {\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_tax_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "rounding_adjustment": {\n "amount_money": {},\n "name": "",\n "uid": ""\n },\n "source_order_id": "",\n "uid": ""\n }\n ],\n "rewards": [\n {\n "id": "",\n "reward_tier_id": ""\n }\n ],\n "rounding_adjustment": {},\n "service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "type": "",\n "uid": ""\n }\n ],\n "source": {\n "name": ""\n },\n "state": "",\n "taxes": [\n {\n "applied_money": {},\n "auto_applied": false,\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "tenders": [\n {\n "additional_recipients": [\n {}\n ],\n "amount_money": {},\n "card_details": {\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "entry_method": "",\n "status": ""\n },\n "cash_details": {\n "buyer_tendered_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "id": "",\n "location_id": "",\n "note": "",\n "payment_id": "",\n "processing_fee_money": {},\n "tip_money": {},\n "transaction_id": "",\n "type": ""\n }\n ],\n "total_discount_money": {},\n "total_money": {},\n "total_service_charge_money": {},\n "total_tax_money": {},\n "total_tip_money": {},\n "updated_at": "",\n "version": 0\n },\n "proposed_rewards": [\n {}\n ]\n}' \
--output-document \
- {{baseUrl}}/v2/orders/calculate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"order": [
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
[
"amount_money": [
"amount": 0,
"currency": ""
],
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
]
],
"fulfillments": [
[
"metadata": [],
"pickup_details": [
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": [
"buyer_arrived_at": "",
"curbside_details": ""
],
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
],
"rejected_at": "",
"schedule_type": ""
],
"shipment_details": [
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": [],
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
],
"state": "",
"type": "",
"uid": ""
]
],
"id": "",
"line_items": [
[
"applied_discounts": [
[
"applied_money": [],
"discount_uid": "",
"uid": ""
]
],
"applied_taxes": [
[
"applied_money": [],
"tax_uid": "",
"uid": ""
]
],
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": [],
"item_type": "",
"metadata": [],
"modifiers": [
[
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": [],
"uid": ""
]
],
"name": "",
"note": "",
"pricing_blocklists": [
"blocked_discounts": [
[
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
]
],
"blocked_taxes": [
[
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
]
]
],
"quantity": "",
"quantity_unit": [
"catalog_version": 0,
"measurement_unit": [
"area_unit": "",
"custom_unit": [
"abbreviation": "",
"name": ""
],
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
],
"precision": 0
],
"total_discount_money": [],
"total_money": [],
"total_tax_money": [],
"uid": "",
"variation_name": "",
"variation_total_price_money": []
]
],
"location_id": "",
"metadata": [],
"net_amounts": [
"discount_money": [],
"service_charge_money": [],
"tax_money": [],
"tip_money": [],
"total_money": []
],
"pricing_options": [
"auto_apply_discounts": false,
"auto_apply_taxes": false
],
"reference_id": "",
"refunds": [
[
"additional_recipients": [
[
"amount_money": [],
"description": "",
"location_id": "",
"receivable_id": ""
]
],
"amount_money": [],
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": [],
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
]
],
"return_amounts": [],
"returns": [
[
"return_amounts": [],
"return_discounts": [
[
"amount_money": [],
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
]
],
"return_line_items": [
[
"applied_discounts": [[]],
"applied_taxes": [[]],
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": [],
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": [],
"return_modifiers": [
[
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": [],
"uid": ""
]
],
"source_line_item_uid": "",
"total_discount_money": [],
"total_money": [],
"total_tax_money": [],
"uid": "",
"variation_name": "",
"variation_total_price_money": []
]
],
"return_service_charges": [
[
"amount_money": [],
"applied_money": [],
"applied_taxes": [[]],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": [],
"total_tax_money": [],
"uid": ""
]
],
"return_taxes": [
[
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
]
],
"rounding_adjustment": [
"amount_money": [],
"name": "",
"uid": ""
],
"source_order_id": "",
"uid": ""
]
],
"rewards": [
[
"id": "",
"reward_tier_id": ""
]
],
"rounding_adjustment": [],
"service_charges": [
[
"amount_money": [],
"applied_money": [],
"applied_taxes": [[]],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"taxable": false,
"total_money": [],
"total_tax_money": [],
"type": "",
"uid": ""
]
],
"source": ["name": ""],
"state": "",
"taxes": [
[
"applied_money": [],
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
]
],
"tenders": [
[
"additional_recipients": [[]],
"amount_money": [],
"card_details": [
"card": [
"billing_address": [],
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
],
"entry_method": "",
"status": ""
],
"cash_details": [
"buyer_tendered_money": [],
"change_back_money": []
],
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": [],
"tip_money": [],
"transaction_id": "",
"type": ""
]
],
"total_discount_money": [],
"total_money": [],
"total_service_charge_money": [],
"total_tax_money": [],
"total_tip_money": [],
"updated_at": "",
"version": 0
],
"proposed_rewards": [[]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/orders/calculate")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"order": {
"created_at": "2020-05-18T16:30:49.614Z",
"discounts": [
{
"applied_money": {
"amount": 550,
"currency": "USD"
},
"name": "50% Off",
"percentage": "50",
"scope": "ORDER",
"type": "FIXED_PERCENTAGE",
"uid": "zGsRZP69aqSSR9lq9euSPB"
}
],
"line_items": [
{
"applied_discounts": [
{
"applied_money": {
"amount": 250,
"currency": "USD"
},
"discount_uid": "zGsRZP69aqSSR9lq9euSPB",
"uid": "9zr9S4dxvPAixvn0lpa1VC"
}
],
"base_price_money": {
"amount": 500,
"currency": "USD"
},
"gross_sales_money": {
"amount": 500,
"currency": "USD"
},
"name": "Item 1",
"quantity": "1",
"total_discount_money": {
"amount": 250,
"currency": "USD"
},
"total_money": {
"amount": 250,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"uid": "ULkg0tQTRK2bkU9fNv3IJD",
"variation_total_price_money": {
"amount": 500,
"currency": "USD"
}
},
{
"applied_discounts": [
{
"applied_money": {
"amount": 300,
"currency": "USD"
},
"discount_uid": "zGsRZP69aqSSR9lq9euSPB",
"uid": "qa8LwwZK82FgSEkQc2HYVC"
}
],
"base_price_money": {
"amount": 300,
"currency": "USD"
},
"gross_sales_money": {
"amount": 600,
"currency": "USD"
},
"name": "Item 2",
"quantity": "2",
"total_discount_money": {
"amount": 300,
"currency": "USD"
},
"total_money": {
"amount": 300,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"uid": "mumY8Nun4BC5aKe2yyx5a",
"variation_total_price_money": {
"amount": 600,
"currency": "USD"
}
}
],
"location_id": "D7AVYMEAPJ3A3",
"net_amounts": {
"discount_money": {
"amount": 550,
"currency": "USD"
},
"service_charge_money": {
"amount": 0,
"currency": "USD"
},
"tax_money": {
"amount": 0,
"currency": "USD"
},
"tip_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 550,
"currency": "USD"
}
},
"state": "OPEN",
"total_discount_money": {
"amount": 550,
"currency": "USD"
},
"total_money": {
"amount": 550,
"currency": "USD"
},
"total_service_charge_money": {
"amount": 0,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"total_tip_money": {
"amount": 0,
"currency": "USD"
},
"updated_at": "2020-05-18T16:30:49.614Z",
"version": 1
}
}
POST
CreateOrder
{{baseUrl}}/v2/orders
BODY json
{
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/orders");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/orders" {:content-type :json
:form-params {:idempotency_key ""
:order {:closed_at ""
:created_at ""
:customer_id ""
:discounts [{:amount_money {:amount 0
:currency ""}
:applied_money {}
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:pricing_rule_id ""
:reward_ids []
:scope ""
:type ""
:uid ""}]
:fulfillments [{:metadata {}
:pickup_details {:accepted_at ""
:auto_complete_duration ""
:cancel_reason ""
:canceled_at ""
:curbside_pickup_details {:buyer_arrived_at ""
:curbside_details ""}
:expired_at ""
:expires_at ""
:is_curbside_pickup false
:note ""
:picked_up_at ""
:pickup_at ""
:pickup_window_duration ""
:placed_at ""
:prep_time_duration ""
:ready_at ""
:recipient {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:customer_id ""
:display_name ""
:email_address ""
:phone_number ""}
:rejected_at ""
:schedule_type ""}
:shipment_details {:cancel_reason ""
:canceled_at ""
:carrier ""
:expected_shipped_at ""
:failed_at ""
:failure_reason ""
:in_progress_at ""
:packaged_at ""
:placed_at ""
:recipient {}
:shipped_at ""
:shipping_note ""
:shipping_type ""
:tracking_number ""
:tracking_url ""}
:state ""
:type ""
:uid ""}]
:id ""
:line_items [{:applied_discounts [{:applied_money {}
:discount_uid ""
:uid ""}]
:applied_taxes [{:applied_money {}
:tax_uid ""
:uid ""}]
:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:gross_sales_money {}
:item_type ""
:metadata {}
:modifiers [{:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:total_price_money {}
:uid ""}]
:name ""
:note ""
:pricing_blocklists {:blocked_discounts [{:discount_catalog_object_id ""
:discount_uid ""
:uid ""}]
:blocked_taxes [{:tax_catalog_object_id ""
:tax_uid ""
:uid ""}]}
:quantity ""
:quantity_unit {:catalog_version 0
:measurement_unit {:area_unit ""
:custom_unit {:abbreviation ""
:name ""}
:generic_unit ""
:length_unit ""
:time_unit ""
:type ""
:volume_unit ""
:weight_unit ""}
:precision 0}
:total_discount_money {}
:total_money {}
:total_tax_money {}
:uid ""
:variation_name ""
:variation_total_price_money {}}]
:location_id ""
:metadata {}
:net_amounts {:discount_money {}
:service_charge_money {}
:tax_money {}
:tip_money {}
:total_money {}}
:pricing_options {:auto_apply_discounts false
:auto_apply_taxes false}
:reference_id ""
:refunds [{:additional_recipients [{:amount_money {}
:description ""
:location_id ""
:receivable_id ""}]
:amount_money {}
:created_at ""
:id ""
:location_id ""
:processing_fee_money {}
:reason ""
:status ""
:tender_id ""
:transaction_id ""}]
:return_amounts {}
:returns [{:return_amounts {}
:return_discounts [{:amount_money {}
:applied_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:scope ""
:source_discount_uid ""
:type ""
:uid ""}]
:return_line_items [{:applied_discounts [{}]
:applied_taxes [{}]
:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:gross_return_money {}
:item_type ""
:name ""
:note ""
:quantity ""
:quantity_unit {}
:return_modifiers [{:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:source_modifier_uid ""
:total_price_money {}
:uid ""}]
:source_line_item_uid ""
:total_discount_money {}
:total_money {}
:total_tax_money {}
:uid ""
:variation_name ""
:variation_total_price_money {}}]
:return_service_charges [{:amount_money {}
:applied_money {}
:applied_taxes [{}]
:calculation_phase ""
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:source_service_charge_uid ""
:taxable false
:total_money {}
:total_tax_money {}
:uid ""}]
:return_taxes [{:applied_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:scope ""
:source_tax_uid ""
:type ""
:uid ""}]
:rounding_adjustment {:amount_money {}
:name ""
:uid ""}
:source_order_id ""
:uid ""}]
:rewards [{:id ""
:reward_tier_id ""}]
:rounding_adjustment {}
:service_charges [{:amount_money {}
:applied_money {}
:applied_taxes [{}]
:calculation_phase ""
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:taxable false
:total_money {}
:total_tax_money {}
:type ""
:uid ""}]
:source {:name ""}
:state ""
:taxes [{:applied_money {}
:auto_applied false
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:scope ""
:type ""
:uid ""}]
:tenders [{:additional_recipients [{}]
:amount_money {}
:card_details {:card {:billing_address {}
:bin ""
:card_brand ""
:card_type ""
:cardholder_name ""
:customer_id ""
:enabled false
:exp_month 0
:exp_year 0
:fingerprint ""
:id ""
:last_4 ""
:prepaid_type ""
:reference_id ""
:version 0}
:entry_method ""
:status ""}
:cash_details {:buyer_tendered_money {}
:change_back_money {}}
:created_at ""
:customer_id ""
:id ""
:location_id ""
:note ""
:payment_id ""
:processing_fee_money {}
:tip_money {}
:transaction_id ""
:type ""}]
:total_discount_money {}
:total_money {}
:total_service_charge_money {}
:total_tax_money {}
:total_tip_money {}
:updated_at ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/orders"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/orders"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/orders");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/orders"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/orders HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 9895
{
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/orders")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/orders"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/orders")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/orders")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {
amount: 0,
currency: ''
},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {
buyer_arrived_at: '',
curbside_details: ''
},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [
{
applied_money: {},
discount_uid: '',
uid: ''
}
],
applied_taxes: [
{
applied_money: {},
tax_uid: '',
uid: ''
}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [
{
discount_catalog_object_id: '',
discount_uid: '',
uid: ''
}
],
blocked_taxes: [
{
tax_catalog_object_id: '',
tax_uid: '',
uid: ''
}
]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {
auto_apply_discounts: false,
auto_apply_taxes: false
},
reference_id: '',
refunds: [
{
additional_recipients: [
{
amount_money: {},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [
{}
],
applied_taxes: [
{}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {
amount_money: {},
name: '',
uid: ''
},
source_order_id: '',
uid: ''
}
],
rewards: [
{
id: '',
reward_tier_id: ''
}
],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {
name: ''
},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [
{}
],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {
buyer_tendered_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/orders');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/orders';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","order":{"closed_at":"","created_at":"","customer_id":"","discounts":[{"amount_money":{"amount":0,"currency":""},"applied_money":{},"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","pricing_rule_id":"","reward_ids":[],"scope":"","type":"","uid":""}],"fulfillments":[{"metadata":{},"pickup_details":{"accepted_at":"","auto_complete_duration":"","cancel_reason":"","canceled_at":"","curbside_pickup_details":{"buyer_arrived_at":"","curbside_details":""},"expired_at":"","expires_at":"","is_curbside_pickup":false,"note":"","picked_up_at":"","pickup_at":"","pickup_window_duration":"","placed_at":"","prep_time_duration":"","ready_at":"","recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"customer_id":"","display_name":"","email_address":"","phone_number":""},"rejected_at":"","schedule_type":""},"shipment_details":{"cancel_reason":"","canceled_at":"","carrier":"","expected_shipped_at":"","failed_at":"","failure_reason":"","in_progress_at":"","packaged_at":"","placed_at":"","recipient":{},"shipped_at":"","shipping_note":"","shipping_type":"","tracking_number":"","tracking_url":""},"state":"","type":"","uid":""}],"id":"","line_items":[{"applied_discounts":[{"applied_money":{},"discount_uid":"","uid":""}],"applied_taxes":[{"applied_money":{},"tax_uid":"","uid":""}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_sales_money":{},"item_type":"","metadata":{},"modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","total_price_money":{},"uid":""}],"name":"","note":"","pricing_blocklists":{"blocked_discounts":[{"discount_catalog_object_id":"","discount_uid":"","uid":""}],"blocked_taxes":[{"tax_catalog_object_id":"","tax_uid":"","uid":""}]},"quantity":"","quantity_unit":{"catalog_version":0,"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"location_id":"","metadata":{},"net_amounts":{"discount_money":{},"service_charge_money":{},"tax_money":{},"tip_money":{},"total_money":{}},"pricing_options":{"auto_apply_discounts":false,"auto_apply_taxes":false},"reference_id":"","refunds":[{"additional_recipients":[{"amount_money":{},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"created_at":"","id":"","location_id":"","processing_fee_money":{},"reason":"","status":"","tender_id":"","transaction_id":""}],"return_amounts":{},"returns":[{"return_amounts":{},"return_discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_discount_uid":"","type":"","uid":""}],"return_line_items":[{"applied_discounts":[{}],"applied_taxes":[{}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_return_money":{},"item_type":"","name":"","note":"","quantity":"","quantity_unit":{},"return_modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","source_modifier_uid":"","total_price_money":{},"uid":""}],"source_line_item_uid":"","total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"return_service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"name":"","percentage":"","source_service_charge_uid":"","taxable":false,"total_money":{},"total_tax_money":{},"uid":""}],"return_taxes":[{"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_tax_uid":"","type":"","uid":""}],"rounding_adjustment":{"amount_money":{},"name":"","uid":""},"source_order_id":"","uid":""}],"rewards":[{"id":"","reward_tier_id":""}],"rounding_adjustment":{},"service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","taxable":false,"total_money":{},"total_tax_money":{},"type":"","uid":""}],"source":{"name":""},"state":"","taxes":[{"applied_money":{},"auto_applied":false,"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","scope":"","type":"","uid":""}],"tenders":[{"additional_recipients":[{}],"amount_money":{},"card_details":{"card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"entry_method":"","status":""},"cash_details":{"buyer_tendered_money":{},"change_back_money":{}},"created_at":"","customer_id":"","id":"","location_id":"","note":"","payment_id":"","processing_fee_money":{},"tip_money":{},"transaction_id":"","type":""}],"total_discount_money":{},"total_money":{},"total_service_charge_money":{},"total_tax_money":{},"total_tip_money":{},"updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/orders',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "order": {\n "closed_at": "",\n "created_at": "",\n "customer_id": "",\n "discounts": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "pricing_rule_id": "",\n "reward_ids": [],\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "fulfillments": [\n {\n "metadata": {},\n "pickup_details": {\n "accepted_at": "",\n "auto_complete_duration": "",\n "cancel_reason": "",\n "canceled_at": "",\n "curbside_pickup_details": {\n "buyer_arrived_at": "",\n "curbside_details": ""\n },\n "expired_at": "",\n "expires_at": "",\n "is_curbside_pickup": false,\n "note": "",\n "picked_up_at": "",\n "pickup_at": "",\n "pickup_window_duration": "",\n "placed_at": "",\n "prep_time_duration": "",\n "ready_at": "",\n "recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "customer_id": "",\n "display_name": "",\n "email_address": "",\n "phone_number": ""\n },\n "rejected_at": "",\n "schedule_type": ""\n },\n "shipment_details": {\n "cancel_reason": "",\n "canceled_at": "",\n "carrier": "",\n "expected_shipped_at": "",\n "failed_at": "",\n "failure_reason": "",\n "in_progress_at": "",\n "packaged_at": "",\n "placed_at": "",\n "recipient": {},\n "shipped_at": "",\n "shipping_note": "",\n "shipping_type": "",\n "tracking_number": "",\n "tracking_url": ""\n },\n "state": "",\n "type": "",\n "uid": ""\n }\n ],\n "id": "",\n "line_items": [\n {\n "applied_discounts": [\n {\n "applied_money": {},\n "discount_uid": "",\n "uid": ""\n }\n ],\n "applied_taxes": [\n {\n "applied_money": {},\n "tax_uid": "",\n "uid": ""\n }\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_sales_money": {},\n "item_type": "",\n "metadata": {},\n "modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "name": "",\n "note": "",\n "pricing_blocklists": {\n "blocked_discounts": [\n {\n "discount_catalog_object_id": "",\n "discount_uid": "",\n "uid": ""\n }\n ],\n "blocked_taxes": [\n {\n "tax_catalog_object_id": "",\n "tax_uid": "",\n "uid": ""\n }\n ]\n },\n "quantity": "",\n "quantity_unit": {\n "catalog_version": 0,\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "location_id": "",\n "metadata": {},\n "net_amounts": {\n "discount_money": {},\n "service_charge_money": {},\n "tax_money": {},\n "tip_money": {},\n "total_money": {}\n },\n "pricing_options": {\n "auto_apply_discounts": false,\n "auto_apply_taxes": false\n },\n "reference_id": "",\n "refunds": [\n {\n "additional_recipients": [\n {\n "amount_money": {},\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "created_at": "",\n "id": "",\n "location_id": "",\n "processing_fee_money": {},\n "reason": "",\n "status": "",\n "tender_id": "",\n "transaction_id": ""\n }\n ],\n "return_amounts": {},\n "returns": [\n {\n "return_amounts": {},\n "return_discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_discount_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "return_line_items": [\n {\n "applied_discounts": [\n {}\n ],\n "applied_taxes": [\n {}\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_return_money": {},\n "item_type": "",\n "name": "",\n "note": "",\n "quantity": "",\n "quantity_unit": {},\n "return_modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "source_modifier_uid": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "source_line_item_uid": "",\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "return_service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "source_service_charge_uid": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "uid": ""\n }\n ],\n "return_taxes": [\n {\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_tax_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "rounding_adjustment": {\n "amount_money": {},\n "name": "",\n "uid": ""\n },\n "source_order_id": "",\n "uid": ""\n }\n ],\n "rewards": [\n {\n "id": "",\n "reward_tier_id": ""\n }\n ],\n "rounding_adjustment": {},\n "service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "type": "",\n "uid": ""\n }\n ],\n "source": {\n "name": ""\n },\n "state": "",\n "taxes": [\n {\n "applied_money": {},\n "auto_applied": false,\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "tenders": [\n {\n "additional_recipients": [\n {}\n ],\n "amount_money": {},\n "card_details": {\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "entry_method": "",\n "status": ""\n },\n "cash_details": {\n "buyer_tendered_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "id": "",\n "location_id": "",\n "note": "",\n "payment_id": "",\n "processing_fee_money": {},\n "tip_money": {},\n "transaction_id": "",\n "type": ""\n }\n ],\n "total_discount_money": {},\n "total_money": {},\n "total_service_charge_money": {},\n "total_tax_money": {},\n "total_tip_money": {},\n "updated_at": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/orders")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/orders',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/orders');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {
amount: 0,
currency: ''
},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {
buyer_arrived_at: '',
curbside_details: ''
},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [
{
applied_money: {},
discount_uid: '',
uid: ''
}
],
applied_taxes: [
{
applied_money: {},
tax_uid: '',
uid: ''
}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [
{
discount_catalog_object_id: '',
discount_uid: '',
uid: ''
}
],
blocked_taxes: [
{
tax_catalog_object_id: '',
tax_uid: '',
uid: ''
}
]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {
auto_apply_discounts: false,
auto_apply_taxes: false
},
reference_id: '',
refunds: [
{
additional_recipients: [
{
amount_money: {},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [
{}
],
applied_taxes: [
{}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {
amount_money: {},
name: '',
uid: ''
},
source_order_id: '',
uid: ''
}
],
rewards: [
{
id: '',
reward_tier_id: ''
}
],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {
name: ''
},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [
{}
],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {
buyer_tendered_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/orders';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","order":{"closed_at":"","created_at":"","customer_id":"","discounts":[{"amount_money":{"amount":0,"currency":""},"applied_money":{},"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","pricing_rule_id":"","reward_ids":[],"scope":"","type":"","uid":""}],"fulfillments":[{"metadata":{},"pickup_details":{"accepted_at":"","auto_complete_duration":"","cancel_reason":"","canceled_at":"","curbside_pickup_details":{"buyer_arrived_at":"","curbside_details":""},"expired_at":"","expires_at":"","is_curbside_pickup":false,"note":"","picked_up_at":"","pickup_at":"","pickup_window_duration":"","placed_at":"","prep_time_duration":"","ready_at":"","recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"customer_id":"","display_name":"","email_address":"","phone_number":""},"rejected_at":"","schedule_type":""},"shipment_details":{"cancel_reason":"","canceled_at":"","carrier":"","expected_shipped_at":"","failed_at":"","failure_reason":"","in_progress_at":"","packaged_at":"","placed_at":"","recipient":{},"shipped_at":"","shipping_note":"","shipping_type":"","tracking_number":"","tracking_url":""},"state":"","type":"","uid":""}],"id":"","line_items":[{"applied_discounts":[{"applied_money":{},"discount_uid":"","uid":""}],"applied_taxes":[{"applied_money":{},"tax_uid":"","uid":""}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_sales_money":{},"item_type":"","metadata":{},"modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","total_price_money":{},"uid":""}],"name":"","note":"","pricing_blocklists":{"blocked_discounts":[{"discount_catalog_object_id":"","discount_uid":"","uid":""}],"blocked_taxes":[{"tax_catalog_object_id":"","tax_uid":"","uid":""}]},"quantity":"","quantity_unit":{"catalog_version":0,"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"location_id":"","metadata":{},"net_amounts":{"discount_money":{},"service_charge_money":{},"tax_money":{},"tip_money":{},"total_money":{}},"pricing_options":{"auto_apply_discounts":false,"auto_apply_taxes":false},"reference_id":"","refunds":[{"additional_recipients":[{"amount_money":{},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"created_at":"","id":"","location_id":"","processing_fee_money":{},"reason":"","status":"","tender_id":"","transaction_id":""}],"return_amounts":{},"returns":[{"return_amounts":{},"return_discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_discount_uid":"","type":"","uid":""}],"return_line_items":[{"applied_discounts":[{}],"applied_taxes":[{}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_return_money":{},"item_type":"","name":"","note":"","quantity":"","quantity_unit":{},"return_modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","source_modifier_uid":"","total_price_money":{},"uid":""}],"source_line_item_uid":"","total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"return_service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"name":"","percentage":"","source_service_charge_uid":"","taxable":false,"total_money":{},"total_tax_money":{},"uid":""}],"return_taxes":[{"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_tax_uid":"","type":"","uid":""}],"rounding_adjustment":{"amount_money":{},"name":"","uid":""},"source_order_id":"","uid":""}],"rewards":[{"id":"","reward_tier_id":""}],"rounding_adjustment":{},"service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","taxable":false,"total_money":{},"total_tax_money":{},"type":"","uid":""}],"source":{"name":""},"state":"","taxes":[{"applied_money":{},"auto_applied":false,"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","scope":"","type":"","uid":""}],"tenders":[{"additional_recipients":[{}],"amount_money":{},"card_details":{"card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"entry_method":"","status":""},"cash_details":{"buyer_tendered_money":{},"change_back_money":{}},"created_at":"","customer_id":"","id":"","location_id":"","note":"","payment_id":"","processing_fee_money":{},"tip_money":{},"transaction_id":"","type":""}],"total_discount_money":{},"total_money":{},"total_service_charge_money":{},"total_tax_money":{},"total_tip_money":{},"updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"order": @{ @"closed_at": @"", @"created_at": @"", @"customer_id": @"", @"discounts": @[ @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"pricing_rule_id": @"", @"reward_ids": @[ ], @"scope": @"", @"type": @"", @"uid": @"" } ], @"fulfillments": @[ @{ @"metadata": @{ }, @"pickup_details": @{ @"accepted_at": @"", @"auto_complete_duration": @"", @"cancel_reason": @"", @"canceled_at": @"", @"curbside_pickup_details": @{ @"buyer_arrived_at": @"", @"curbside_details": @"" }, @"expired_at": @"", @"expires_at": @"", @"is_curbside_pickup": @NO, @"note": @"", @"picked_up_at": @"", @"pickup_at": @"", @"pickup_window_duration": @"", @"placed_at": @"", @"prep_time_duration": @"", @"ready_at": @"", @"recipient": @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"customer_id": @"", @"display_name": @"", @"email_address": @"", @"phone_number": @"" }, @"rejected_at": @"", @"schedule_type": @"" }, @"shipment_details": @{ @"cancel_reason": @"", @"canceled_at": @"", @"carrier": @"", @"expected_shipped_at": @"", @"failed_at": @"", @"failure_reason": @"", @"in_progress_at": @"", @"packaged_at": @"", @"placed_at": @"", @"recipient": @{ }, @"shipped_at": @"", @"shipping_note": @"", @"shipping_type": @"", @"tracking_number": @"", @"tracking_url": @"" }, @"state": @"", @"type": @"", @"uid": @"" } ], @"id": @"", @"line_items": @[ @{ @"applied_discounts": @[ @{ @"applied_money": @{ }, @"discount_uid": @"", @"uid": @"" } ], @"applied_taxes": @[ @{ @"applied_money": @{ }, @"tax_uid": @"", @"uid": @"" } ], @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"gross_sales_money": @{ }, @"item_type": @"", @"metadata": @{ }, @"modifiers": @[ @{ @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"total_price_money": @{ }, @"uid": @"" } ], @"name": @"", @"note": @"", @"pricing_blocklists": @{ @"blocked_discounts": @[ @{ @"discount_catalog_object_id": @"", @"discount_uid": @"", @"uid": @"" } ], @"blocked_taxes": @[ @{ @"tax_catalog_object_id": @"", @"tax_uid": @"", @"uid": @"" } ] }, @"quantity": @"", @"quantity_unit": @{ @"catalog_version": @0, @"measurement_unit": @{ @"area_unit": @"", @"custom_unit": @{ @"abbreviation": @"", @"name": @"" }, @"generic_unit": @"", @"length_unit": @"", @"time_unit": @"", @"type": @"", @"volume_unit": @"", @"weight_unit": @"" }, @"precision": @0 }, @"total_discount_money": @{ }, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"", @"variation_name": @"", @"variation_total_price_money": @{ } } ], @"location_id": @"", @"metadata": @{ }, @"net_amounts": @{ @"discount_money": @{ }, @"service_charge_money": @{ }, @"tax_money": @{ }, @"tip_money": @{ }, @"total_money": @{ } }, @"pricing_options": @{ @"auto_apply_discounts": @NO, @"auto_apply_taxes": @NO }, @"reference_id": @"", @"refunds": @[ @{ @"additional_recipients": @[ @{ @"amount_money": @{ }, @"description": @"", @"location_id": @"", @"receivable_id": @"" } ], @"amount_money": @{ }, @"created_at": @"", @"id": @"", @"location_id": @"", @"processing_fee_money": @{ }, @"reason": @"", @"status": @"", @"tender_id": @"", @"transaction_id": @"" } ], @"return_amounts": @{ }, @"returns": @[ @{ @"return_amounts": @{ }, @"return_discounts": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"scope": @"", @"source_discount_uid": @"", @"type": @"", @"uid": @"" } ], @"return_line_items": @[ @{ @"applied_discounts": @[ @{ } ], @"applied_taxes": @[ @{ } ], @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"gross_return_money": @{ }, @"item_type": @"", @"name": @"", @"note": @"", @"quantity": @"", @"quantity_unit": @{ }, @"return_modifiers": @[ @{ @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"source_modifier_uid": @"", @"total_price_money": @{ }, @"uid": @"" } ], @"source_line_item_uid": @"", @"total_discount_money": @{ }, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"", @"variation_name": @"", @"variation_total_price_money": @{ } } ], @"return_service_charges": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"applied_taxes": @[ @{ } ], @"calculation_phase": @"", @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"source_service_charge_uid": @"", @"taxable": @NO, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"" } ], @"return_taxes": @[ @{ @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"scope": @"", @"source_tax_uid": @"", @"type": @"", @"uid": @"" } ], @"rounding_adjustment": @{ @"amount_money": @{ }, @"name": @"", @"uid": @"" }, @"source_order_id": @"", @"uid": @"" } ], @"rewards": @[ @{ @"id": @"", @"reward_tier_id": @"" } ], @"rounding_adjustment": @{ }, @"service_charges": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"applied_taxes": @[ @{ } ], @"calculation_phase": @"", @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"taxable": @NO, @"total_money": @{ }, @"total_tax_money": @{ }, @"type": @"", @"uid": @"" } ], @"source": @{ @"name": @"" }, @"state": @"", @"taxes": @[ @{ @"applied_money": @{ }, @"auto_applied": @NO, @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"scope": @"", @"type": @"", @"uid": @"" } ], @"tenders": @[ @{ @"additional_recipients": @[ @{ } ], @"amount_money": @{ }, @"card_details": @{ @"card": @{ @"billing_address": @{ }, @"bin": @"", @"card_brand": @"", @"card_type": @"", @"cardholder_name": @"", @"customer_id": @"", @"enabled": @NO, @"exp_month": @0, @"exp_year": @0, @"fingerprint": @"", @"id": @"", @"last_4": @"", @"prepaid_type": @"", @"reference_id": @"", @"version": @0 }, @"entry_method": @"", @"status": @"" }, @"cash_details": @{ @"buyer_tendered_money": @{ }, @"change_back_money": @{ } }, @"created_at": @"", @"customer_id": @"", @"id": @"", @"location_id": @"", @"note": @"", @"payment_id": @"", @"processing_fee_money": @{ }, @"tip_money": @{ }, @"transaction_id": @"", @"type": @"" } ], @"total_discount_money": @{ }, @"total_money": @{ }, @"total_service_charge_money": @{ }, @"total_tax_money": @{ }, @"total_tip_money": @{ }, @"updated_at": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/orders"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/orders" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/orders', [
'body' => '{
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/orders');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/orders');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/orders' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/orders' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/orders", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/orders"
payload = {
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": False,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": False,
"auto_apply_taxes": False
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [{}],
"applied_taxes": [{}],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [{}],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": False,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [{}],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": False,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": { "name": "" },
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": False,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [{}],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": False,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/orders"
payload <- "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/orders') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/orders";
let payload = json!({
"idempotency_key": "",
"order": json!({
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": (
json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": (),
"scope": "",
"type": "",
"uid": ""
})
),
"fulfillments": (
json!({
"metadata": json!({}),
"pickup_details": json!({
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": json!({
"buyer_arrived_at": "",
"curbside_details": ""
}),
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
}),
"rejected_at": "",
"schedule_type": ""
}),
"shipment_details": json!({
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": json!({}),
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
}),
"state": "",
"type": "",
"uid": ""
})
),
"id": "",
"line_items": (
json!({
"applied_discounts": (
json!({
"applied_money": json!({}),
"discount_uid": "",
"uid": ""
})
),
"applied_taxes": (
json!({
"applied_money": json!({}),
"tax_uid": "",
"uid": ""
})
),
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": json!({}),
"item_type": "",
"metadata": json!({}),
"modifiers": (
json!({
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": json!({}),
"uid": ""
})
),
"name": "",
"note": "",
"pricing_blocklists": json!({
"blocked_discounts": (
json!({
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
})
),
"blocked_taxes": (
json!({
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
})
)
}),
"quantity": "",
"quantity_unit": json!({
"catalog_version": 0,
"measurement_unit": json!({
"area_unit": "",
"custom_unit": json!({
"abbreviation": "",
"name": ""
}),
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
}),
"precision": 0
}),
"total_discount_money": json!({}),
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": "",
"variation_name": "",
"variation_total_price_money": json!({})
})
),
"location_id": "",
"metadata": json!({}),
"net_amounts": json!({
"discount_money": json!({}),
"service_charge_money": json!({}),
"tax_money": json!({}),
"tip_money": json!({}),
"total_money": json!({})
}),
"pricing_options": json!({
"auto_apply_discounts": false,
"auto_apply_taxes": false
}),
"reference_id": "",
"refunds": (
json!({
"additional_recipients": (
json!({
"amount_money": json!({}),
"description": "",
"location_id": "",
"receivable_id": ""
})
),
"amount_money": json!({}),
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": json!({}),
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
})
),
"return_amounts": json!({}),
"returns": (
json!({
"return_amounts": json!({}),
"return_discounts": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
})
),
"return_line_items": (
json!({
"applied_discounts": (json!({})),
"applied_taxes": (json!({})),
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": json!({}),
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": json!({}),
"return_modifiers": (
json!({
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": json!({}),
"uid": ""
})
),
"source_line_item_uid": "",
"total_discount_money": json!({}),
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": "",
"variation_name": "",
"variation_total_price_money": json!({})
})
),
"return_service_charges": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"applied_taxes": (json!({})),
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": ""
})
),
"return_taxes": (
json!({
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
})
),
"rounding_adjustment": json!({
"amount_money": json!({}),
"name": "",
"uid": ""
}),
"source_order_id": "",
"uid": ""
})
),
"rewards": (
json!({
"id": "",
"reward_tier_id": ""
})
),
"rounding_adjustment": json!({}),
"service_charges": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"applied_taxes": (json!({})),
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"taxable": false,
"total_money": json!({}),
"total_tax_money": json!({}),
"type": "",
"uid": ""
})
),
"source": json!({"name": ""}),
"state": "",
"taxes": (
json!({
"applied_money": json!({}),
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
})
),
"tenders": (
json!({
"additional_recipients": (json!({})),
"amount_money": json!({}),
"card_details": json!({
"card": json!({
"billing_address": json!({}),
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
}),
"entry_method": "",
"status": ""
}),
"cash_details": json!({
"buyer_tendered_money": json!({}),
"change_back_money": json!({})
}),
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": json!({}),
"tip_money": json!({}),
"transaction_id": "",
"type": ""
})
),
"total_discount_money": json!({}),
"total_money": json!({}),
"total_service_charge_money": json!({}),
"total_tax_money": json!({}),
"total_tip_money": json!({}),
"updated_at": "",
"version": 0
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/orders \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}'
echo '{
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}' | \
http POST {{baseUrl}}/v2/orders \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "order": {\n "closed_at": "",\n "created_at": "",\n "customer_id": "",\n "discounts": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "pricing_rule_id": "",\n "reward_ids": [],\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "fulfillments": [\n {\n "metadata": {},\n "pickup_details": {\n "accepted_at": "",\n "auto_complete_duration": "",\n "cancel_reason": "",\n "canceled_at": "",\n "curbside_pickup_details": {\n "buyer_arrived_at": "",\n "curbside_details": ""\n },\n "expired_at": "",\n "expires_at": "",\n "is_curbside_pickup": false,\n "note": "",\n "picked_up_at": "",\n "pickup_at": "",\n "pickup_window_duration": "",\n "placed_at": "",\n "prep_time_duration": "",\n "ready_at": "",\n "recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "customer_id": "",\n "display_name": "",\n "email_address": "",\n "phone_number": ""\n },\n "rejected_at": "",\n "schedule_type": ""\n },\n "shipment_details": {\n "cancel_reason": "",\n "canceled_at": "",\n "carrier": "",\n "expected_shipped_at": "",\n "failed_at": "",\n "failure_reason": "",\n "in_progress_at": "",\n "packaged_at": "",\n "placed_at": "",\n "recipient": {},\n "shipped_at": "",\n "shipping_note": "",\n "shipping_type": "",\n "tracking_number": "",\n "tracking_url": ""\n },\n "state": "",\n "type": "",\n "uid": ""\n }\n ],\n "id": "",\n "line_items": [\n {\n "applied_discounts": [\n {\n "applied_money": {},\n "discount_uid": "",\n "uid": ""\n }\n ],\n "applied_taxes": [\n {\n "applied_money": {},\n "tax_uid": "",\n "uid": ""\n }\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_sales_money": {},\n "item_type": "",\n "metadata": {},\n "modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "name": "",\n "note": "",\n "pricing_blocklists": {\n "blocked_discounts": [\n {\n "discount_catalog_object_id": "",\n "discount_uid": "",\n "uid": ""\n }\n ],\n "blocked_taxes": [\n {\n "tax_catalog_object_id": "",\n "tax_uid": "",\n "uid": ""\n }\n ]\n },\n "quantity": "",\n "quantity_unit": {\n "catalog_version": 0,\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "location_id": "",\n "metadata": {},\n "net_amounts": {\n "discount_money": {},\n "service_charge_money": {},\n "tax_money": {},\n "tip_money": {},\n "total_money": {}\n },\n "pricing_options": {\n "auto_apply_discounts": false,\n "auto_apply_taxes": false\n },\n "reference_id": "",\n "refunds": [\n {\n "additional_recipients": [\n {\n "amount_money": {},\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "created_at": "",\n "id": "",\n "location_id": "",\n "processing_fee_money": {},\n "reason": "",\n "status": "",\n "tender_id": "",\n "transaction_id": ""\n }\n ],\n "return_amounts": {},\n "returns": [\n {\n "return_amounts": {},\n "return_discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_discount_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "return_line_items": [\n {\n "applied_discounts": [\n {}\n ],\n "applied_taxes": [\n {}\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_return_money": {},\n "item_type": "",\n "name": "",\n "note": "",\n "quantity": "",\n "quantity_unit": {},\n "return_modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "source_modifier_uid": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "source_line_item_uid": "",\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "return_service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "source_service_charge_uid": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "uid": ""\n }\n ],\n "return_taxes": [\n {\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_tax_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "rounding_adjustment": {\n "amount_money": {},\n "name": "",\n "uid": ""\n },\n "source_order_id": "",\n "uid": ""\n }\n ],\n "rewards": [\n {\n "id": "",\n "reward_tier_id": ""\n }\n ],\n "rounding_adjustment": {},\n "service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "type": "",\n "uid": ""\n }\n ],\n "source": {\n "name": ""\n },\n "state": "",\n "taxes": [\n {\n "applied_money": {},\n "auto_applied": false,\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "tenders": [\n {\n "additional_recipients": [\n {}\n ],\n "amount_money": {},\n "card_details": {\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "entry_method": "",\n "status": ""\n },\n "cash_details": {\n "buyer_tendered_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "id": "",\n "location_id": "",\n "note": "",\n "payment_id": "",\n "processing_fee_money": {},\n "tip_money": {},\n "transaction_id": "",\n "type": ""\n }\n ],\n "total_discount_money": {},\n "total_money": {},\n "total_service_charge_money": {},\n "total_tax_money": {},\n "total_tip_money": {},\n "updated_at": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/orders
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"order": [
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
[
"amount_money": [
"amount": 0,
"currency": ""
],
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
]
],
"fulfillments": [
[
"metadata": [],
"pickup_details": [
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": [
"buyer_arrived_at": "",
"curbside_details": ""
],
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
],
"rejected_at": "",
"schedule_type": ""
],
"shipment_details": [
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": [],
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
],
"state": "",
"type": "",
"uid": ""
]
],
"id": "",
"line_items": [
[
"applied_discounts": [
[
"applied_money": [],
"discount_uid": "",
"uid": ""
]
],
"applied_taxes": [
[
"applied_money": [],
"tax_uid": "",
"uid": ""
]
],
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": [],
"item_type": "",
"metadata": [],
"modifiers": [
[
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": [],
"uid": ""
]
],
"name": "",
"note": "",
"pricing_blocklists": [
"blocked_discounts": [
[
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
]
],
"blocked_taxes": [
[
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
]
]
],
"quantity": "",
"quantity_unit": [
"catalog_version": 0,
"measurement_unit": [
"area_unit": "",
"custom_unit": [
"abbreviation": "",
"name": ""
],
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
],
"precision": 0
],
"total_discount_money": [],
"total_money": [],
"total_tax_money": [],
"uid": "",
"variation_name": "",
"variation_total_price_money": []
]
],
"location_id": "",
"metadata": [],
"net_amounts": [
"discount_money": [],
"service_charge_money": [],
"tax_money": [],
"tip_money": [],
"total_money": []
],
"pricing_options": [
"auto_apply_discounts": false,
"auto_apply_taxes": false
],
"reference_id": "",
"refunds": [
[
"additional_recipients": [
[
"amount_money": [],
"description": "",
"location_id": "",
"receivable_id": ""
]
],
"amount_money": [],
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": [],
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
]
],
"return_amounts": [],
"returns": [
[
"return_amounts": [],
"return_discounts": [
[
"amount_money": [],
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
]
],
"return_line_items": [
[
"applied_discounts": [[]],
"applied_taxes": [[]],
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": [],
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": [],
"return_modifiers": [
[
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": [],
"uid": ""
]
],
"source_line_item_uid": "",
"total_discount_money": [],
"total_money": [],
"total_tax_money": [],
"uid": "",
"variation_name": "",
"variation_total_price_money": []
]
],
"return_service_charges": [
[
"amount_money": [],
"applied_money": [],
"applied_taxes": [[]],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": [],
"total_tax_money": [],
"uid": ""
]
],
"return_taxes": [
[
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
]
],
"rounding_adjustment": [
"amount_money": [],
"name": "",
"uid": ""
],
"source_order_id": "",
"uid": ""
]
],
"rewards": [
[
"id": "",
"reward_tier_id": ""
]
],
"rounding_adjustment": [],
"service_charges": [
[
"amount_money": [],
"applied_money": [],
"applied_taxes": [[]],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"taxable": false,
"total_money": [],
"total_tax_money": [],
"type": "",
"uid": ""
]
],
"source": ["name": ""],
"state": "",
"taxes": [
[
"applied_money": [],
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
]
],
"tenders": [
[
"additional_recipients": [[]],
"amount_money": [],
"card_details": [
"card": [
"billing_address": [],
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
],
"entry_method": "",
"status": ""
],
"cash_details": [
"buyer_tendered_money": [],
"change_back_money": []
],
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": [],
"tip_money": [],
"transaction_id": "",
"type": ""
]
],
"total_discount_money": [],
"total_money": [],
"total_service_charge_money": [],
"total_tax_money": [],
"total_tip_money": [],
"updated_at": "",
"version": 0
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/orders")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"order": {
"created_at": "2020-01-17T20:47:53.293Z",
"discounts": [
{
"applied_money": {
"amount": 30,
"currency": "USD"
},
"catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7",
"name": "Membership Discount",
"percentage": "0.5",
"scope": "ORDER",
"type": "FIXED_PERCENTAGE",
"uid": "membership-discount"
},
{
"applied_money": {
"amount": 303,
"currency": "USD"
},
"name": "Labor Day Sale",
"percentage": "5",
"scope": "ORDER",
"type": "FIXED_PERCENTAGE",
"uid": "labor-day-sale"
},
{
"amount_money": {
"amount": 100,
"currency": "USD"
},
"applied_money": {
"amount": 100,
"currency": "USD"
},
"name": "Sale - $1.00 off",
"scope": "LINE_ITEM",
"type": "FIXED_AMOUNT",
"uid": "one-dollar-off"
}
],
"id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {
"amount": 8,
"currency": "USD"
},
"discount_uid": "membership-discount",
"uid": "jWdgP1TpHPFBuVrz81mXVC"
},
{
"applied_money": {
"amount": 79,
"currency": "USD"
},
"discount_uid": "labor-day-sale",
"uid": "jnZOjjVY57eRcQAVgEwFuC"
}
],
"applied_taxes": [
{
"applied_money": {
"amount": 136,
"currency": "USD"
},
"tax_uid": "state-sales-tax",
"uid": "aKG87ArnDpvMLSZJHxWUl"
}
],
"base_price_money": {
"amount": 1599,
"currency": "USD"
},
"gross_sales_money": {
"amount": 1599,
"currency": "USD"
},
"name": "New York Strip Steak",
"quantity": "1",
"total_discount_money": {
"amount": 87,
"currency": "USD"
},
"total_money": {
"amount": 1648,
"currency": "USD"
},
"total_tax_money": {
"amount": 136,
"currency": "USD"
},
"uid": "8uSwfzvUImn3IRrvciqlXC",
"variation_total_price_money": {
"amount": 1599,
"currency": "USD"
}
},
{
"applied_discounts": [
{
"applied_money": {
"amount": 22,
"currency": "USD"
},
"discount_uid": "membership-discount",
"uid": "nUXvdsIItfKko0dbYtY58C"
},
{
"applied_money": {
"amount": 224,
"currency": "USD"
},
"discount_uid": "labor-day-sale",
"uid": "qSdkOOOernlVQqsJ94SPjB"
},
{
"applied_money": {
"amount": 100,
"currency": "USD"
},
"discount_uid": "one-dollar-off",
"uid": "y7bVl4njrWAnfDwmz19izB"
}
],
"applied_taxes": [
{
"applied_money": {
"amount": 374,
"currency": "USD"
},
"tax_uid": "state-sales-tax",
"uid": "v1dAgrfUVUPTnVTf9sRPz"
}
],
"base_price_money": {
"amount": 2200,
"currency": "USD"
},
"catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB",
"gross_sales_money": {
"amount": 4500,
"currency": "USD"
},
"modifiers": [
{
"base_price_money": {
"amount": 50,
"currency": "USD"
},
"catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ",
"name": "Well",
"total_price_money": {
"amount": 100,
"currency": "USD"
},
"uid": "Lo3qMMckDluu9Qsb58d4CC"
}
],
"name": "New York Steak",
"quantity": "2",
"total_discount_money": {
"amount": 346,
"currency": "USD"
},
"total_money": {
"amount": 4528,
"currency": "USD"
},
"total_tax_money": {
"amount": 374,
"currency": "USD"
},
"uid": "v8ZuEXpOJpb0bazLuvrLDB",
"variation_name": "Larger",
"variation_total_price_money": {
"amount": 4400,
"currency": "USD"
}
}
],
"location_id": "057P5VYJ4A5X1",
"net_amounts": {
"discount_money": {
"amount": 433,
"currency": "USD"
},
"service_charge_money": {
"amount": 0,
"currency": "USD"
},
"tax_money": {
"amount": 510,
"currency": "USD"
},
"tip_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 6176,
"currency": "USD"
}
},
"reference_id": "my-order-001",
"source": {
"name": "My App"
},
"state": "OPEN",
"taxes": [
{
"applied_money": {
"amount": 510,
"currency": "USD"
},
"name": "State Sales Tax",
"percentage": "9",
"scope": "ORDER",
"type": "ADDITIVE",
"uid": "state-sales-tax"
}
],
"total_discount_money": {
"amount": 433,
"currency": "USD"
},
"total_money": {
"amount": 6176,
"currency": "USD"
},
"total_service_charge_money": {
"amount": 0,
"currency": "USD"
},
"total_tax_money": {
"amount": 510,
"currency": "USD"
},
"total_tip_money": {
"amount": 0,
"currency": "USD"
},
"updated_at": "2020-01-17T20:47:53.293Z",
"version": 1
}
}
POST
PayOrder
{{baseUrl}}/v2/orders/:order_id/pay
QUERY PARAMS
order_id
BODY json
{
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/orders/:order_id/pay");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/orders/:order_id/pay" {:content-type :json
:form-params {:idempotency_key ""
:order_version 0
:payment_ids []}})
require "http/client"
url = "{{baseUrl}}/v2/orders/:order_id/pay"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/orders/:order_id/pay"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/orders/:order_id/pay");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/orders/:order_id/pay"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/orders/:order_id/pay HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 70
{
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/orders/:order_id/pay")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/orders/:order_id/pay"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/orders/:order_id/pay")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/orders/:order_id/pay")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
order_version: 0,
payment_ids: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/orders/:order_id/pay');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/:order_id/pay',
headers: {'content-type': 'application/json'},
data: {idempotency_key: '', order_version: 0, payment_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/orders/:order_id/pay';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","order_version":0,"payment_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/orders/:order_id/pay',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "order_version": 0,\n "payment_ids": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/orders/:order_id/pay")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/orders/:order_id/pay',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({idempotency_key: '', order_version: 0, payment_ids: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/:order_id/pay',
headers: {'content-type': 'application/json'},
body: {idempotency_key: '', order_version: 0, payment_ids: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/orders/:order_id/pay');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
order_version: 0,
payment_ids: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/:order_id/pay',
headers: {'content-type': 'application/json'},
data: {idempotency_key: '', order_version: 0, payment_ids: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/orders/:order_id/pay';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","order_version":0,"payment_ids":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"order_version": @0,
@"payment_ids": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/orders/:order_id/pay"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/orders/:order_id/pay" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/orders/:order_id/pay",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'order_version' => 0,
'payment_ids' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/orders/:order_id/pay', [
'body' => '{
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/orders/:order_id/pay');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'order_version' => 0,
'payment_ids' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'order_version' => 0,
'payment_ids' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/orders/:order_id/pay');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/orders/:order_id/pay' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/orders/:order_id/pay' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/orders/:order_id/pay", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/orders/:order_id/pay"
payload = {
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/orders/:order_id/pay"
payload <- "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/orders/:order_id/pay")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/orders/:order_id/pay') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"order_version\": 0,\n \"payment_ids\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/orders/:order_id/pay";
let payload = json!({
"idempotency_key": "",
"order_version": 0,
"payment_ids": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/orders/:order_id/pay \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
}'
echo '{
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
}' | \
http POST {{baseUrl}}/v2/orders/:order_id/pay \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "order_version": 0,\n "payment_ids": []\n}' \
--output-document \
- {{baseUrl}}/v2/orders/:order_id/pay
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"order_version": 0,
"payment_ids": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/orders/:order_id/pay")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"order": {
"closed_at": "2019-08-06T02:47:37.140Z",
"created_at": "2019-08-06T02:47:35.693Z",
"id": "lgwOlEityYPJtcuvKTVKT1pA986YY",
"line_items": [
{
"base_price_money": {
"amount": 500,
"currency": "USD"
},
"gross_sales_money": {
"amount": 500,
"currency": "USD"
},
"name": "Item 1",
"quantity": "1",
"total_discount_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 500,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"uid": "QW6kofLHJK7JEKMjlSVP5C"
},
{
"base_price_money": {
"amount": 750,
"currency": "USD"
},
"gross_sales_money": {
"amount": 1500,
"currency": "USD"
},
"name": "Item 2",
"quantity": "2",
"total_discount_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 1500,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"uid": "zhw8MNfRGdFQMI2WE1UBJD"
}
],
"location_id": "P3CCK6HSNDAS7",
"net_amounts": {
"discount_money": {
"amount": 0,
"currency": "USD"
},
"service_charge_money": {
"amount": 0,
"currency": "USD"
},
"tax_money": {
"amount": 0,
"currency": "USD"
},
"tip_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 2000,
"currency": "USD"
}
},
"source": {
"name": "Source Name"
},
"state": "COMPLETED",
"tenders": [
{
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"card_details": {
"card": {
"card_brand": "VISA",
"exp_month": 2,
"exp_year": 2022,
"fingerprint": "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ",
"last_4": "1111"
},
"entry_method": "KEYED",
"status": "CAPTURED"
},
"created_at": "2019-08-06T02:47:36.293Z",
"id": "EnZdNAlWCmfh6Mt5FMNST1o7taB",
"location_id": "P3CCK6HSNDAS7",
"payment_id": "EnZdNAlWCmfh6Mt5FMNST1o7taB",
"transaction_id": "lgwOlEityYPJtcuvKTVKT1pA986YY",
"type": "CARD"
},
{
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"card_details": {
"card": {
"card_brand": "VISA",
"exp_month": 2,
"exp_year": 2022,
"fingerprint": "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ",
"last_4": "1111"
},
"entry_method": "KEYED",
"status": "CAPTURED"
},
"created_at": "2019-08-06T02:47:36.809Z",
"id": "0LRiVlbXVwe8ozu4KbZxd12mvaB",
"location_id": "P3CCK6HSNDAS7",
"payment_id": "0LRiVlbXVwe8ozu4KbZxd12mvaB",
"transaction_id": "lgwOlEityYPJtcuvKTVKT1pA986YY",
"type": "CARD"
}
],
"total_discount_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 2000,
"currency": "USD"
},
"total_service_charge_money": {
"amount": 0,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"updated_at": "2019-08-06T02:47:37.140Z",
"version": 4
}
}
GET
RetrieveOrder (GET)
{{baseUrl}}/v2/orders/:order_id
QUERY PARAMS
order_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/orders/:order_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/orders/:order_id")
require "http/client"
url = "{{baseUrl}}/v2/orders/:order_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/orders/:order_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/orders/:order_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/orders/:order_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/orders/:order_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/orders/:order_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/orders/:order_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/orders/:order_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/orders/:order_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/orders/:order_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/orders/:order_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/orders/:order_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/orders/:order_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/orders/:order_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/orders/:order_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/orders/:order_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/orders/:order_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/orders/:order_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/orders/:order_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/orders/:order_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/orders/:order_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/orders/:order_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/orders/:order_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/orders/:order_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/orders/:order_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/orders/:order_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/orders/:order_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/orders/:order_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/orders/:order_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/orders/:order_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/orders/:order_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/orders/:order_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/orders/:order_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/orders/:order_id
http GET {{baseUrl}}/v2/orders/:order_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/orders/:order_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/orders/:order_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"order": {
"created_at": "2020-05-18T16:30:49.614Z",
"discounts": [
{
"applied_money": {
"amount": 550,
"currency": "USD"
},
"name": "50% Off",
"percentage": "50",
"scope": "ORDER",
"type": "FIXED_PERCENTAGE",
"uid": "zGsRZP69aqSSR9lq9euSPB"
}
],
"id": "CAISENgvlJ6jLWAzERDzjyHVybY",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {
"amount": 250,
"currency": "USD"
},
"discount_uid": "zGsRZP69aqSSR9lq9euSPB",
"uid": "9zr9S4dxvPAixvn0lpa1VC"
}
],
"base_price_money": {
"amount": 500,
"currency": "USD"
},
"gross_sales_money": {
"amount": 500,
"currency": "USD"
},
"name": "Item 1",
"quantity": "1",
"total_discount_money": {
"amount": 250,
"currency": "USD"
},
"total_money": {
"amount": 250,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"uid": "ULkg0tQTRK2bkU9fNv3IJD",
"variation_total_price_money": {
"amount": 500,
"currency": "USD"
}
},
{
"applied_discounts": [
{
"applied_money": {
"amount": 300,
"currency": "USD"
},
"discount_uid": "zGsRZP69aqSSR9lq9euSPB",
"uid": "qa8LwwZK82FgSEkQc2HYVC"
}
],
"base_price_money": {
"amount": 300,
"currency": "USD"
},
"gross_sales_money": {
"amount": 600,
"currency": "USD"
},
"name": "Item 2",
"quantity": "2",
"total_discount_money": {
"amount": 300,
"currency": "USD"
},
"total_money": {
"amount": 300,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"uid": "mumY8Nun4BC5aKe2yyx5a",
"variation_total_price_money": {
"amount": 600,
"currency": "USD"
}
}
],
"location_id": "D7AVYMEAPJ3A3",
"net_amounts": {
"discount_money": {
"amount": 550,
"currency": "USD"
},
"service_charge_money": {
"amount": 0,
"currency": "USD"
},
"tax_money": {
"amount": 0,
"currency": "USD"
},
"tip_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 550,
"currency": "USD"
}
},
"state": "OPEN",
"total_discount_money": {
"amount": 550,
"currency": "USD"
},
"total_money": {
"amount": 550,
"currency": "USD"
},
"total_service_charge_money": {
"amount": 0,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"total_tip_money": {
"amount": 0,
"currency": "USD"
},
"updated_at": "2020-05-18T16:30:49.614Z",
"version": 1
}
}
POST
SearchOrders
{{baseUrl}}/v2/orders/search
BODY json
{
"cursor": "",
"limit": 0,
"location_ids": [],
"query": {
"filter": {
"customer_filter": {
"customer_ids": []
},
"date_time_filter": {
"closed_at": {
"end_at": "",
"start_at": ""
},
"created_at": {},
"updated_at": {}
},
"fulfillment_filter": {
"fulfillment_states": [],
"fulfillment_types": []
},
"source_filter": {
"source_names": []
},
"state_filter": {
"states": []
}
},
"sort": {
"sort_field": "",
"sort_order": ""
}
},
"return_entries": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/orders/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/orders/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:location_ids []
:query {:filter {:customer_filter {:customer_ids []}
:date_time_filter {:closed_at {:end_at ""
:start_at ""}
:created_at {}
:updated_at {}}
:fulfillment_filter {:fulfillment_states []
:fulfillment_types []}
:source_filter {:source_names []}
:state_filter {:states []}}
:sort {:sort_field ""
:sort_order ""}}
:return_entries false}})
require "http/client"
url = "{{baseUrl}}/v2/orders/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/orders/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/orders/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/orders/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/orders/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 642
{
"cursor": "",
"limit": 0,
"location_ids": [],
"query": {
"filter": {
"customer_filter": {
"customer_ids": []
},
"date_time_filter": {
"closed_at": {
"end_at": "",
"start_at": ""
},
"created_at": {},
"updated_at": {}
},
"fulfillment_filter": {
"fulfillment_states": [],
"fulfillment_types": []
},
"source_filter": {
"source_names": []
},
"state_filter": {
"states": []
}
},
"sort": {
"sort_field": "",
"sort_order": ""
}
},
"return_entries": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/orders/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/orders/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/orders/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/orders/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
location_ids: [],
query: {
filter: {
customer_filter: {
customer_ids: []
},
date_time_filter: {
closed_at: {
end_at: '',
start_at: ''
},
created_at: {},
updated_at: {}
},
fulfillment_filter: {
fulfillment_states: [],
fulfillment_types: []
},
source_filter: {
source_names: []
},
state_filter: {
states: []
}
},
sort: {
sort_field: '',
sort_order: ''
}
},
return_entries: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/orders/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
location_ids: [],
query: {
filter: {
customer_filter: {customer_ids: []},
date_time_filter: {closed_at: {end_at: '', start_at: ''}, created_at: {}, updated_at: {}},
fulfillment_filter: {fulfillment_states: [], fulfillment_types: []},
source_filter: {source_names: []},
state_filter: {states: []}
},
sort: {sort_field: '', sort_order: ''}
},
return_entries: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/orders/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"location_ids":[],"query":{"filter":{"customer_filter":{"customer_ids":[]},"date_time_filter":{"closed_at":{"end_at":"","start_at":""},"created_at":{},"updated_at":{}},"fulfillment_filter":{"fulfillment_states":[],"fulfillment_types":[]},"source_filter":{"source_names":[]},"state_filter":{"states":[]}},"sort":{"sort_field":"","sort_order":""}},"return_entries":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/orders/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "location_ids": [],\n "query": {\n "filter": {\n "customer_filter": {\n "customer_ids": []\n },\n "date_time_filter": {\n "closed_at": {\n "end_at": "",\n "start_at": ""\n },\n "created_at": {},\n "updated_at": {}\n },\n "fulfillment_filter": {\n "fulfillment_states": [],\n "fulfillment_types": []\n },\n "source_filter": {\n "source_names": []\n },\n "state_filter": {\n "states": []\n }\n },\n "sort": {\n "sort_field": "",\n "sort_order": ""\n }\n },\n "return_entries": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/orders/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/orders/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cursor: '',
limit: 0,
location_ids: [],
query: {
filter: {
customer_filter: {customer_ids: []},
date_time_filter: {closed_at: {end_at: '', start_at: ''}, created_at: {}, updated_at: {}},
fulfillment_filter: {fulfillment_states: [], fulfillment_types: []},
source_filter: {source_names: []},
state_filter: {states: []}
},
sort: {sort_field: '', sort_order: ''}
},
return_entries: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/search',
headers: {'content-type': 'application/json'},
body: {
cursor: '',
limit: 0,
location_ids: [],
query: {
filter: {
customer_filter: {customer_ids: []},
date_time_filter: {closed_at: {end_at: '', start_at: ''}, created_at: {}, updated_at: {}},
fulfillment_filter: {fulfillment_states: [], fulfillment_types: []},
source_filter: {source_names: []},
state_filter: {states: []}
},
sort: {sort_field: '', sort_order: ''}
},
return_entries: false
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/orders/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
location_ids: [],
query: {
filter: {
customer_filter: {
customer_ids: []
},
date_time_filter: {
closed_at: {
end_at: '',
start_at: ''
},
created_at: {},
updated_at: {}
},
fulfillment_filter: {
fulfillment_states: [],
fulfillment_types: []
},
source_filter: {
source_names: []
},
state_filter: {
states: []
}
},
sort: {
sort_field: '',
sort_order: ''
}
},
return_entries: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/orders/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
location_ids: [],
query: {
filter: {
customer_filter: {customer_ids: []},
date_time_filter: {closed_at: {end_at: '', start_at: ''}, created_at: {}, updated_at: {}},
fulfillment_filter: {fulfillment_states: [], fulfillment_types: []},
source_filter: {source_names: []},
state_filter: {states: []}
},
sort: {sort_field: '', sort_order: ''}
},
return_entries: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/orders/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"location_ids":[],"query":{"filter":{"customer_filter":{"customer_ids":[]},"date_time_filter":{"closed_at":{"end_at":"","start_at":""},"created_at":{},"updated_at":{}},"fulfillment_filter":{"fulfillment_states":[],"fulfillment_types":[]},"source_filter":{"source_names":[]},"state_filter":{"states":[]}},"sort":{"sort_field":"","sort_order":""}},"return_entries":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"location_ids": @[ ],
@"query": @{ @"filter": @{ @"customer_filter": @{ @"customer_ids": @[ ] }, @"date_time_filter": @{ @"closed_at": @{ @"end_at": @"", @"start_at": @"" }, @"created_at": @{ }, @"updated_at": @{ } }, @"fulfillment_filter": @{ @"fulfillment_states": @[ ], @"fulfillment_types": @[ ] }, @"source_filter": @{ @"source_names": @[ ] }, @"state_filter": @{ @"states": @[ ] } }, @"sort": @{ @"sort_field": @"", @"sort_order": @"" } },
@"return_entries": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/orders/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/orders/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/orders/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'location_ids' => [
],
'query' => [
'filter' => [
'customer_filter' => [
'customer_ids' => [
]
],
'date_time_filter' => [
'closed_at' => [
'end_at' => '',
'start_at' => ''
],
'created_at' => [
],
'updated_at' => [
]
],
'fulfillment_filter' => [
'fulfillment_states' => [
],
'fulfillment_types' => [
]
],
'source_filter' => [
'source_names' => [
]
],
'state_filter' => [
'states' => [
]
]
],
'sort' => [
'sort_field' => '',
'sort_order' => ''
]
],
'return_entries' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/orders/search', [
'body' => '{
"cursor": "",
"limit": 0,
"location_ids": [],
"query": {
"filter": {
"customer_filter": {
"customer_ids": []
},
"date_time_filter": {
"closed_at": {
"end_at": "",
"start_at": ""
},
"created_at": {},
"updated_at": {}
},
"fulfillment_filter": {
"fulfillment_states": [],
"fulfillment_types": []
},
"source_filter": {
"source_names": []
},
"state_filter": {
"states": []
}
},
"sort": {
"sort_field": "",
"sort_order": ""
}
},
"return_entries": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/orders/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'location_ids' => [
],
'query' => [
'filter' => [
'customer_filter' => [
'customer_ids' => [
]
],
'date_time_filter' => [
'closed_at' => [
'end_at' => '',
'start_at' => ''
],
'created_at' => [
],
'updated_at' => [
]
],
'fulfillment_filter' => [
'fulfillment_states' => [
],
'fulfillment_types' => [
]
],
'source_filter' => [
'source_names' => [
]
],
'state_filter' => [
'states' => [
]
]
],
'sort' => [
'sort_field' => '',
'sort_order' => ''
]
],
'return_entries' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'location_ids' => [
],
'query' => [
'filter' => [
'customer_filter' => [
'customer_ids' => [
]
],
'date_time_filter' => [
'closed_at' => [
'end_at' => '',
'start_at' => ''
],
'created_at' => [
],
'updated_at' => [
]
],
'fulfillment_filter' => [
'fulfillment_states' => [
],
'fulfillment_types' => [
]
],
'source_filter' => [
'source_names' => [
]
],
'state_filter' => [
'states' => [
]
]
],
'sort' => [
'sort_field' => '',
'sort_order' => ''
]
],
'return_entries' => null
]));
$request->setRequestUrl('{{baseUrl}}/v2/orders/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/orders/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"location_ids": [],
"query": {
"filter": {
"customer_filter": {
"customer_ids": []
},
"date_time_filter": {
"closed_at": {
"end_at": "",
"start_at": ""
},
"created_at": {},
"updated_at": {}
},
"fulfillment_filter": {
"fulfillment_states": [],
"fulfillment_types": []
},
"source_filter": {
"source_names": []
},
"state_filter": {
"states": []
}
},
"sort": {
"sort_field": "",
"sort_order": ""
}
},
"return_entries": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/orders/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"location_ids": [],
"query": {
"filter": {
"customer_filter": {
"customer_ids": []
},
"date_time_filter": {
"closed_at": {
"end_at": "",
"start_at": ""
},
"created_at": {},
"updated_at": {}
},
"fulfillment_filter": {
"fulfillment_states": [],
"fulfillment_types": []
},
"source_filter": {
"source_names": []
},
"state_filter": {
"states": []
}
},
"sort": {
"sort_field": "",
"sort_order": ""
}
},
"return_entries": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/orders/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/orders/search"
payload = {
"cursor": "",
"limit": 0,
"location_ids": [],
"query": {
"filter": {
"customer_filter": { "customer_ids": [] },
"date_time_filter": {
"closed_at": {
"end_at": "",
"start_at": ""
},
"created_at": {},
"updated_at": {}
},
"fulfillment_filter": {
"fulfillment_states": [],
"fulfillment_types": []
},
"source_filter": { "source_names": [] },
"state_filter": { "states": [] }
},
"sort": {
"sort_field": "",
"sort_order": ""
}
},
"return_entries": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/orders/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/orders/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/orders/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"location_ids\": [],\n \"query\": {\n \"filter\": {\n \"customer_filter\": {\n \"customer_ids\": []\n },\n \"date_time_filter\": {\n \"closed_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"created_at\": {},\n \"updated_at\": {}\n },\n \"fulfillment_filter\": {\n \"fulfillment_states\": [],\n \"fulfillment_types\": []\n },\n \"source_filter\": {\n \"source_names\": []\n },\n \"state_filter\": {\n \"states\": []\n }\n },\n \"sort\": {\n \"sort_field\": \"\",\n \"sort_order\": \"\"\n }\n },\n \"return_entries\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/orders/search";
let payload = json!({
"cursor": "",
"limit": 0,
"location_ids": (),
"query": json!({
"filter": json!({
"customer_filter": json!({"customer_ids": ()}),
"date_time_filter": json!({
"closed_at": json!({
"end_at": "",
"start_at": ""
}),
"created_at": json!({}),
"updated_at": json!({})
}),
"fulfillment_filter": json!({
"fulfillment_states": (),
"fulfillment_types": ()
}),
"source_filter": json!({"source_names": ()}),
"state_filter": json!({"states": ()})
}),
"sort": json!({
"sort_field": "",
"sort_order": ""
})
}),
"return_entries": false
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/orders/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"location_ids": [],
"query": {
"filter": {
"customer_filter": {
"customer_ids": []
},
"date_time_filter": {
"closed_at": {
"end_at": "",
"start_at": ""
},
"created_at": {},
"updated_at": {}
},
"fulfillment_filter": {
"fulfillment_states": [],
"fulfillment_types": []
},
"source_filter": {
"source_names": []
},
"state_filter": {
"states": []
}
},
"sort": {
"sort_field": "",
"sort_order": ""
}
},
"return_entries": false
}'
echo '{
"cursor": "",
"limit": 0,
"location_ids": [],
"query": {
"filter": {
"customer_filter": {
"customer_ids": []
},
"date_time_filter": {
"closed_at": {
"end_at": "",
"start_at": ""
},
"created_at": {},
"updated_at": {}
},
"fulfillment_filter": {
"fulfillment_states": [],
"fulfillment_types": []
},
"source_filter": {
"source_names": []
},
"state_filter": {
"states": []
}
},
"sort": {
"sort_field": "",
"sort_order": ""
}
},
"return_entries": false
}' | \
http POST {{baseUrl}}/v2/orders/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "location_ids": [],\n "query": {\n "filter": {\n "customer_filter": {\n "customer_ids": []\n },\n "date_time_filter": {\n "closed_at": {\n "end_at": "",\n "start_at": ""\n },\n "created_at": {},\n "updated_at": {}\n },\n "fulfillment_filter": {\n "fulfillment_states": [],\n "fulfillment_types": []\n },\n "source_filter": {\n "source_names": []\n },\n "state_filter": {\n "states": []\n }\n },\n "sort": {\n "sort_field": "",\n "sort_order": ""\n }\n },\n "return_entries": false\n}' \
--output-document \
- {{baseUrl}}/v2/orders/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"location_ids": [],
"query": [
"filter": [
"customer_filter": ["customer_ids": []],
"date_time_filter": [
"closed_at": [
"end_at": "",
"start_at": ""
],
"created_at": [],
"updated_at": []
],
"fulfillment_filter": [
"fulfillment_states": [],
"fulfillment_types": []
],
"source_filter": ["source_names": []],
"state_filter": ["states": []]
],
"sort": [
"sort_field": "",
"sort_order": ""
]
],
"return_entries": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/orders/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "123",
"order_entries": [
{
"location_id": "057P5VYJ4A5X1",
"order_id": "CAISEM82RcpmcFBM0TfOyiHV3es",
"version": 1
},
{
"location_id": "18YC4JDH91E1H",
"order_id": "CAISENgvlJ6jLWAzERDzjyHVybY"
},
{
"location_id": "057P5VYJ4A5X1",
"order_id": "CAISEM52YcpmcWAzERDOyiWS3ty"
}
]
}
PUT
UpdateOrder (PUT)
{{baseUrl}}/v2/orders/:order_id
QUERY PARAMS
order_id
BODY json
{
"fields_to_clear": [],
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/orders/:order_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/orders/:order_id" {:content-type :json
:form-params {:fields_to_clear []
:idempotency_key ""
:order {:closed_at ""
:created_at ""
:customer_id ""
:discounts [{:amount_money {:amount 0
:currency ""}
:applied_money {}
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:pricing_rule_id ""
:reward_ids []
:scope ""
:type ""
:uid ""}]
:fulfillments [{:metadata {}
:pickup_details {:accepted_at ""
:auto_complete_duration ""
:cancel_reason ""
:canceled_at ""
:curbside_pickup_details {:buyer_arrived_at ""
:curbside_details ""}
:expired_at ""
:expires_at ""
:is_curbside_pickup false
:note ""
:picked_up_at ""
:pickup_at ""
:pickup_window_duration ""
:placed_at ""
:prep_time_duration ""
:ready_at ""
:recipient {:address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:customer_id ""
:display_name ""
:email_address ""
:phone_number ""}
:rejected_at ""
:schedule_type ""}
:shipment_details {:cancel_reason ""
:canceled_at ""
:carrier ""
:expected_shipped_at ""
:failed_at ""
:failure_reason ""
:in_progress_at ""
:packaged_at ""
:placed_at ""
:recipient {}
:shipped_at ""
:shipping_note ""
:shipping_type ""
:tracking_number ""
:tracking_url ""}
:state ""
:type ""
:uid ""}]
:id ""
:line_items [{:applied_discounts [{:applied_money {}
:discount_uid ""
:uid ""}]
:applied_taxes [{:applied_money {}
:tax_uid ""
:uid ""}]
:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:gross_sales_money {}
:item_type ""
:metadata {}
:modifiers [{:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:total_price_money {}
:uid ""}]
:name ""
:note ""
:pricing_blocklists {:blocked_discounts [{:discount_catalog_object_id ""
:discount_uid ""
:uid ""}]
:blocked_taxes [{:tax_catalog_object_id ""
:tax_uid ""
:uid ""}]}
:quantity ""
:quantity_unit {:catalog_version 0
:measurement_unit {:area_unit ""
:custom_unit {:abbreviation ""
:name ""}
:generic_unit ""
:length_unit ""
:time_unit ""
:type ""
:volume_unit ""
:weight_unit ""}
:precision 0}
:total_discount_money {}
:total_money {}
:total_tax_money {}
:uid ""
:variation_name ""
:variation_total_price_money {}}]
:location_id ""
:metadata {}
:net_amounts {:discount_money {}
:service_charge_money {}
:tax_money {}
:tip_money {}
:total_money {}}
:pricing_options {:auto_apply_discounts false
:auto_apply_taxes false}
:reference_id ""
:refunds [{:additional_recipients [{:amount_money {}
:description ""
:location_id ""
:receivable_id ""}]
:amount_money {}
:created_at ""
:id ""
:location_id ""
:processing_fee_money {}
:reason ""
:status ""
:tender_id ""
:transaction_id ""}]
:return_amounts {}
:returns [{:return_amounts {}
:return_discounts [{:amount_money {}
:applied_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:scope ""
:source_discount_uid ""
:type ""
:uid ""}]
:return_line_items [{:applied_discounts [{}]
:applied_taxes [{}]
:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:gross_return_money {}
:item_type ""
:name ""
:note ""
:quantity ""
:quantity_unit {}
:return_modifiers [{:base_price_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:source_modifier_uid ""
:total_price_money {}
:uid ""}]
:source_line_item_uid ""
:total_discount_money {}
:total_money {}
:total_tax_money {}
:uid ""
:variation_name ""
:variation_total_price_money {}}]
:return_service_charges [{:amount_money {}
:applied_money {}
:applied_taxes [{}]
:calculation_phase ""
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:source_service_charge_uid ""
:taxable false
:total_money {}
:total_tax_money {}
:uid ""}]
:return_taxes [{:applied_money {}
:catalog_object_id ""
:catalog_version 0
:name ""
:percentage ""
:scope ""
:source_tax_uid ""
:type ""
:uid ""}]
:rounding_adjustment {:amount_money {}
:name ""
:uid ""}
:source_order_id ""
:uid ""}]
:rewards [{:id ""
:reward_tier_id ""}]
:rounding_adjustment {}
:service_charges [{:amount_money {}
:applied_money {}
:applied_taxes [{}]
:calculation_phase ""
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:taxable false
:total_money {}
:total_tax_money {}
:type ""
:uid ""}]
:source {:name ""}
:state ""
:taxes [{:applied_money {}
:auto_applied false
:catalog_object_id ""
:catalog_version 0
:metadata {}
:name ""
:percentage ""
:scope ""
:type ""
:uid ""}]
:tenders [{:additional_recipients [{}]
:amount_money {}
:card_details {:card {:billing_address {}
:bin ""
:card_brand ""
:card_type ""
:cardholder_name ""
:customer_id ""
:enabled false
:exp_month 0
:exp_year 0
:fingerprint ""
:id ""
:last_4 ""
:prepaid_type ""
:reference_id ""
:version 0}
:entry_method ""
:status ""}
:cash_details {:buyer_tendered_money {}
:change_back_money {}}
:created_at ""
:customer_id ""
:id ""
:location_id ""
:note ""
:payment_id ""
:processing_fee_money {}
:tip_money {}
:transaction_id ""
:type ""}]
:total_discount_money {}
:total_money {}
:total_service_charge_money {}
:total_tax_money {}
:total_tip_money {}
:updated_at ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/orders/:order_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/orders/:order_id"),
Content = new StringContent("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/orders/:order_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/orders/:order_id"
payload := strings.NewReader("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/orders/:order_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 9920
{
"fields_to_clear": [],
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/orders/:order_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/orders/:order_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/orders/:order_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/orders/:order_id")
.header("content-type", "application/json")
.body("{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
fields_to_clear: [],
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {
amount: 0,
currency: ''
},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {
buyer_arrived_at: '',
curbside_details: ''
},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [
{
applied_money: {},
discount_uid: '',
uid: ''
}
],
applied_taxes: [
{
applied_money: {},
tax_uid: '',
uid: ''
}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [
{
discount_catalog_object_id: '',
discount_uid: '',
uid: ''
}
],
blocked_taxes: [
{
tax_catalog_object_id: '',
tax_uid: '',
uid: ''
}
]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {
auto_apply_discounts: false,
auto_apply_taxes: false
},
reference_id: '',
refunds: [
{
additional_recipients: [
{
amount_money: {},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [
{}
],
applied_taxes: [
{}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {
amount_money: {},
name: '',
uid: ''
},
source_order_id: '',
uid: ''
}
],
rewards: [
{
id: '',
reward_tier_id: ''
}
],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {
name: ''
},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [
{}
],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {
buyer_tendered_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/orders/:order_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/orders/:order_id',
headers: {'content-type': 'application/json'},
data: {
fields_to_clear: [],
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/orders/:order_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"fields_to_clear":[],"idempotency_key":"","order":{"closed_at":"","created_at":"","customer_id":"","discounts":[{"amount_money":{"amount":0,"currency":""},"applied_money":{},"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","pricing_rule_id":"","reward_ids":[],"scope":"","type":"","uid":""}],"fulfillments":[{"metadata":{},"pickup_details":{"accepted_at":"","auto_complete_duration":"","cancel_reason":"","canceled_at":"","curbside_pickup_details":{"buyer_arrived_at":"","curbside_details":""},"expired_at":"","expires_at":"","is_curbside_pickup":false,"note":"","picked_up_at":"","pickup_at":"","pickup_window_duration":"","placed_at":"","prep_time_duration":"","ready_at":"","recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"customer_id":"","display_name":"","email_address":"","phone_number":""},"rejected_at":"","schedule_type":""},"shipment_details":{"cancel_reason":"","canceled_at":"","carrier":"","expected_shipped_at":"","failed_at":"","failure_reason":"","in_progress_at":"","packaged_at":"","placed_at":"","recipient":{},"shipped_at":"","shipping_note":"","shipping_type":"","tracking_number":"","tracking_url":""},"state":"","type":"","uid":""}],"id":"","line_items":[{"applied_discounts":[{"applied_money":{},"discount_uid":"","uid":""}],"applied_taxes":[{"applied_money":{},"tax_uid":"","uid":""}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_sales_money":{},"item_type":"","metadata":{},"modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","total_price_money":{},"uid":""}],"name":"","note":"","pricing_blocklists":{"blocked_discounts":[{"discount_catalog_object_id":"","discount_uid":"","uid":""}],"blocked_taxes":[{"tax_catalog_object_id":"","tax_uid":"","uid":""}]},"quantity":"","quantity_unit":{"catalog_version":0,"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"location_id":"","metadata":{},"net_amounts":{"discount_money":{},"service_charge_money":{},"tax_money":{},"tip_money":{},"total_money":{}},"pricing_options":{"auto_apply_discounts":false,"auto_apply_taxes":false},"reference_id":"","refunds":[{"additional_recipients":[{"amount_money":{},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"created_at":"","id":"","location_id":"","processing_fee_money":{},"reason":"","status":"","tender_id":"","transaction_id":""}],"return_amounts":{},"returns":[{"return_amounts":{},"return_discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_discount_uid":"","type":"","uid":""}],"return_line_items":[{"applied_discounts":[{}],"applied_taxes":[{}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_return_money":{},"item_type":"","name":"","note":"","quantity":"","quantity_unit":{},"return_modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","source_modifier_uid":"","total_price_money":{},"uid":""}],"source_line_item_uid":"","total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"return_service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"name":"","percentage":"","source_service_charge_uid":"","taxable":false,"total_money":{},"total_tax_money":{},"uid":""}],"return_taxes":[{"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_tax_uid":"","type":"","uid":""}],"rounding_adjustment":{"amount_money":{},"name":"","uid":""},"source_order_id":"","uid":""}],"rewards":[{"id":"","reward_tier_id":""}],"rounding_adjustment":{},"service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","taxable":false,"total_money":{},"total_tax_money":{},"type":"","uid":""}],"source":{"name":""},"state":"","taxes":[{"applied_money":{},"auto_applied":false,"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","scope":"","type":"","uid":""}],"tenders":[{"additional_recipients":[{}],"amount_money":{},"card_details":{"card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"entry_method":"","status":""},"cash_details":{"buyer_tendered_money":{},"change_back_money":{}},"created_at":"","customer_id":"","id":"","location_id":"","note":"","payment_id":"","processing_fee_money":{},"tip_money":{},"transaction_id":"","type":""}],"total_discount_money":{},"total_money":{},"total_service_charge_money":{},"total_tax_money":{},"total_tip_money":{},"updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/orders/:order_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "fields_to_clear": [],\n "idempotency_key": "",\n "order": {\n "closed_at": "",\n "created_at": "",\n "customer_id": "",\n "discounts": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "pricing_rule_id": "",\n "reward_ids": [],\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "fulfillments": [\n {\n "metadata": {},\n "pickup_details": {\n "accepted_at": "",\n "auto_complete_duration": "",\n "cancel_reason": "",\n "canceled_at": "",\n "curbside_pickup_details": {\n "buyer_arrived_at": "",\n "curbside_details": ""\n },\n "expired_at": "",\n "expires_at": "",\n "is_curbside_pickup": false,\n "note": "",\n "picked_up_at": "",\n "pickup_at": "",\n "pickup_window_duration": "",\n "placed_at": "",\n "prep_time_duration": "",\n "ready_at": "",\n "recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "customer_id": "",\n "display_name": "",\n "email_address": "",\n "phone_number": ""\n },\n "rejected_at": "",\n "schedule_type": ""\n },\n "shipment_details": {\n "cancel_reason": "",\n "canceled_at": "",\n "carrier": "",\n "expected_shipped_at": "",\n "failed_at": "",\n "failure_reason": "",\n "in_progress_at": "",\n "packaged_at": "",\n "placed_at": "",\n "recipient": {},\n "shipped_at": "",\n "shipping_note": "",\n "shipping_type": "",\n "tracking_number": "",\n "tracking_url": ""\n },\n "state": "",\n "type": "",\n "uid": ""\n }\n ],\n "id": "",\n "line_items": [\n {\n "applied_discounts": [\n {\n "applied_money": {},\n "discount_uid": "",\n "uid": ""\n }\n ],\n "applied_taxes": [\n {\n "applied_money": {},\n "tax_uid": "",\n "uid": ""\n }\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_sales_money": {},\n "item_type": "",\n "metadata": {},\n "modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "name": "",\n "note": "",\n "pricing_blocklists": {\n "blocked_discounts": [\n {\n "discount_catalog_object_id": "",\n "discount_uid": "",\n "uid": ""\n }\n ],\n "blocked_taxes": [\n {\n "tax_catalog_object_id": "",\n "tax_uid": "",\n "uid": ""\n }\n ]\n },\n "quantity": "",\n "quantity_unit": {\n "catalog_version": 0,\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "location_id": "",\n "metadata": {},\n "net_amounts": {\n "discount_money": {},\n "service_charge_money": {},\n "tax_money": {},\n "tip_money": {},\n "total_money": {}\n },\n "pricing_options": {\n "auto_apply_discounts": false,\n "auto_apply_taxes": false\n },\n "reference_id": "",\n "refunds": [\n {\n "additional_recipients": [\n {\n "amount_money": {},\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "created_at": "",\n "id": "",\n "location_id": "",\n "processing_fee_money": {},\n "reason": "",\n "status": "",\n "tender_id": "",\n "transaction_id": ""\n }\n ],\n "return_amounts": {},\n "returns": [\n {\n "return_amounts": {},\n "return_discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_discount_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "return_line_items": [\n {\n "applied_discounts": [\n {}\n ],\n "applied_taxes": [\n {}\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_return_money": {},\n "item_type": "",\n "name": "",\n "note": "",\n "quantity": "",\n "quantity_unit": {},\n "return_modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "source_modifier_uid": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "source_line_item_uid": "",\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "return_service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "source_service_charge_uid": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "uid": ""\n }\n ],\n "return_taxes": [\n {\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_tax_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "rounding_adjustment": {\n "amount_money": {},\n "name": "",\n "uid": ""\n },\n "source_order_id": "",\n "uid": ""\n }\n ],\n "rewards": [\n {\n "id": "",\n "reward_tier_id": ""\n }\n ],\n "rounding_adjustment": {},\n "service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "type": "",\n "uid": ""\n }\n ],\n "source": {\n "name": ""\n },\n "state": "",\n "taxes": [\n {\n "applied_money": {},\n "auto_applied": false,\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "tenders": [\n {\n "additional_recipients": [\n {}\n ],\n "amount_money": {},\n "card_details": {\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "entry_method": "",\n "status": ""\n },\n "cash_details": {\n "buyer_tendered_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "id": "",\n "location_id": "",\n "note": "",\n "payment_id": "",\n "processing_fee_money": {},\n "tip_money": {},\n "transaction_id": "",\n "type": ""\n }\n ],\n "total_discount_money": {},\n "total_money": {},\n "total_service_charge_money": {},\n "total_tax_money": {},\n "total_tip_money": {},\n "updated_at": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/orders/:order_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/orders/:order_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
fields_to_clear: [],
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/orders/:order_id',
headers: {'content-type': 'application/json'},
body: {
fields_to_clear: [],
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/orders/:order_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
fields_to_clear: [],
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {
amount: 0,
currency: ''
},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {
buyer_arrived_at: '',
curbside_details: ''
},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [
{
applied_money: {},
discount_uid: '',
uid: ''
}
],
applied_taxes: [
{
applied_money: {},
tax_uid: '',
uid: ''
}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [
{
discount_catalog_object_id: '',
discount_uid: '',
uid: ''
}
],
blocked_taxes: [
{
tax_catalog_object_id: '',
tax_uid: '',
uid: ''
}
]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {
abbreviation: '',
name: ''
},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {
auto_apply_discounts: false,
auto_apply_taxes: false
},
reference_id: '',
refunds: [
{
additional_recipients: [
{
amount_money: {},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [
{}
],
applied_taxes: [
{}
],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {
amount_money: {},
name: '',
uid: ''
},
source_order_id: '',
uid: ''
}
],
rewards: [
{
id: '',
reward_tier_id: ''
}
],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [
{}
],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {
name: ''
},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [
{}
],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {
buyer_tendered_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/orders/:order_id',
headers: {'content-type': 'application/json'},
data: {
fields_to_clear: [],
idempotency_key: '',
order: {
closed_at: '',
created_at: '',
customer_id: '',
discounts: [
{
amount_money: {amount: 0, currency: ''},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
pricing_rule_id: '',
reward_ids: [],
scope: '',
type: '',
uid: ''
}
],
fulfillments: [
{
metadata: {},
pickup_details: {
accepted_at: '',
auto_complete_duration: '',
cancel_reason: '',
canceled_at: '',
curbside_pickup_details: {buyer_arrived_at: '', curbside_details: ''},
expired_at: '',
expires_at: '',
is_curbside_pickup: false,
note: '',
picked_up_at: '',
pickup_at: '',
pickup_window_duration: '',
placed_at: '',
prep_time_duration: '',
ready_at: '',
recipient: {
address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
customer_id: '',
display_name: '',
email_address: '',
phone_number: ''
},
rejected_at: '',
schedule_type: ''
},
shipment_details: {
cancel_reason: '',
canceled_at: '',
carrier: '',
expected_shipped_at: '',
failed_at: '',
failure_reason: '',
in_progress_at: '',
packaged_at: '',
placed_at: '',
recipient: {},
shipped_at: '',
shipping_note: '',
shipping_type: '',
tracking_number: '',
tracking_url: ''
},
state: '',
type: '',
uid: ''
}
],
id: '',
line_items: [
{
applied_discounts: [{applied_money: {}, discount_uid: '', uid: ''}],
applied_taxes: [{applied_money: {}, tax_uid: '', uid: ''}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_sales_money: {},
item_type: '',
metadata: {},
modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
total_price_money: {},
uid: ''
}
],
name: '',
note: '',
pricing_blocklists: {
blocked_discounts: [{discount_catalog_object_id: '', discount_uid: '', uid: ''}],
blocked_taxes: [{tax_catalog_object_id: '', tax_uid: '', uid: ''}]
},
quantity: '',
quantity_unit: {
catalog_version: 0,
measurement_unit: {
area_unit: '',
custom_unit: {abbreviation: '', name: ''},
generic_unit: '',
length_unit: '',
time_unit: '',
type: '',
volume_unit: '',
weight_unit: ''
},
precision: 0
},
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
location_id: '',
metadata: {},
net_amounts: {
discount_money: {},
service_charge_money: {},
tax_money: {},
tip_money: {},
total_money: {}
},
pricing_options: {auto_apply_discounts: false, auto_apply_taxes: false},
reference_id: '',
refunds: [
{
additional_recipients: [{amount_money: {}, description: '', location_id: '', receivable_id: ''}],
amount_money: {},
created_at: '',
id: '',
location_id: '',
processing_fee_money: {},
reason: '',
status: '',
tender_id: '',
transaction_id: ''
}
],
return_amounts: {},
returns: [
{
return_amounts: {},
return_discounts: [
{
amount_money: {},
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_discount_uid: '',
type: '',
uid: ''
}
],
return_line_items: [
{
applied_discounts: [{}],
applied_taxes: [{}],
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
gross_return_money: {},
item_type: '',
name: '',
note: '',
quantity: '',
quantity_unit: {},
return_modifiers: [
{
base_price_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
source_modifier_uid: '',
total_price_money: {},
uid: ''
}
],
source_line_item_uid: '',
total_discount_money: {},
total_money: {},
total_tax_money: {},
uid: '',
variation_name: '',
variation_total_price_money: {}
}
],
return_service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
source_service_charge_uid: '',
taxable: false,
total_money: {},
total_tax_money: {},
uid: ''
}
],
return_taxes: [
{
applied_money: {},
catalog_object_id: '',
catalog_version: 0,
name: '',
percentage: '',
scope: '',
source_tax_uid: '',
type: '',
uid: ''
}
],
rounding_adjustment: {amount_money: {}, name: '', uid: ''},
source_order_id: '',
uid: ''
}
],
rewards: [{id: '', reward_tier_id: ''}],
rounding_adjustment: {},
service_charges: [
{
amount_money: {},
applied_money: {},
applied_taxes: [{}],
calculation_phase: '',
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
taxable: false,
total_money: {},
total_tax_money: {},
type: '',
uid: ''
}
],
source: {name: ''},
state: '',
taxes: [
{
applied_money: {},
auto_applied: false,
catalog_object_id: '',
catalog_version: 0,
metadata: {},
name: '',
percentage: '',
scope: '',
type: '',
uid: ''
}
],
tenders: [
{
additional_recipients: [{}],
amount_money: {},
card_details: {
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
entry_method: '',
status: ''
},
cash_details: {buyer_tendered_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
id: '',
location_id: '',
note: '',
payment_id: '',
processing_fee_money: {},
tip_money: {},
transaction_id: '',
type: ''
}
],
total_discount_money: {},
total_money: {},
total_service_charge_money: {},
total_tax_money: {},
total_tip_money: {},
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/orders/:order_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"fields_to_clear":[],"idempotency_key":"","order":{"closed_at":"","created_at":"","customer_id":"","discounts":[{"amount_money":{"amount":0,"currency":""},"applied_money":{},"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","pricing_rule_id":"","reward_ids":[],"scope":"","type":"","uid":""}],"fulfillments":[{"metadata":{},"pickup_details":{"accepted_at":"","auto_complete_duration":"","cancel_reason":"","canceled_at":"","curbside_pickup_details":{"buyer_arrived_at":"","curbside_details":""},"expired_at":"","expires_at":"","is_curbside_pickup":false,"note":"","picked_up_at":"","pickup_at":"","pickup_window_duration":"","placed_at":"","prep_time_duration":"","ready_at":"","recipient":{"address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"customer_id":"","display_name":"","email_address":"","phone_number":""},"rejected_at":"","schedule_type":""},"shipment_details":{"cancel_reason":"","canceled_at":"","carrier":"","expected_shipped_at":"","failed_at":"","failure_reason":"","in_progress_at":"","packaged_at":"","placed_at":"","recipient":{},"shipped_at":"","shipping_note":"","shipping_type":"","tracking_number":"","tracking_url":""},"state":"","type":"","uid":""}],"id":"","line_items":[{"applied_discounts":[{"applied_money":{},"discount_uid":"","uid":""}],"applied_taxes":[{"applied_money":{},"tax_uid":"","uid":""}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_sales_money":{},"item_type":"","metadata":{},"modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","total_price_money":{},"uid":""}],"name":"","note":"","pricing_blocklists":{"blocked_discounts":[{"discount_catalog_object_id":"","discount_uid":"","uid":""}],"blocked_taxes":[{"tax_catalog_object_id":"","tax_uid":"","uid":""}]},"quantity":"","quantity_unit":{"catalog_version":0,"measurement_unit":{"area_unit":"","custom_unit":{"abbreviation":"","name":""},"generic_unit":"","length_unit":"","time_unit":"","type":"","volume_unit":"","weight_unit":""},"precision":0},"total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"location_id":"","metadata":{},"net_amounts":{"discount_money":{},"service_charge_money":{},"tax_money":{},"tip_money":{},"total_money":{}},"pricing_options":{"auto_apply_discounts":false,"auto_apply_taxes":false},"reference_id":"","refunds":[{"additional_recipients":[{"amount_money":{},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"created_at":"","id":"","location_id":"","processing_fee_money":{},"reason":"","status":"","tender_id":"","transaction_id":""}],"return_amounts":{},"returns":[{"return_amounts":{},"return_discounts":[{"amount_money":{},"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_discount_uid":"","type":"","uid":""}],"return_line_items":[{"applied_discounts":[{}],"applied_taxes":[{}],"base_price_money":{},"catalog_object_id":"","catalog_version":0,"gross_return_money":{},"item_type":"","name":"","note":"","quantity":"","quantity_unit":{},"return_modifiers":[{"base_price_money":{},"catalog_object_id":"","catalog_version":0,"name":"","source_modifier_uid":"","total_price_money":{},"uid":""}],"source_line_item_uid":"","total_discount_money":{},"total_money":{},"total_tax_money":{},"uid":"","variation_name":"","variation_total_price_money":{}}],"return_service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"name":"","percentage":"","source_service_charge_uid":"","taxable":false,"total_money":{},"total_tax_money":{},"uid":""}],"return_taxes":[{"applied_money":{},"catalog_object_id":"","catalog_version":0,"name":"","percentage":"","scope":"","source_tax_uid":"","type":"","uid":""}],"rounding_adjustment":{"amount_money":{},"name":"","uid":""},"source_order_id":"","uid":""}],"rewards":[{"id":"","reward_tier_id":""}],"rounding_adjustment":{},"service_charges":[{"amount_money":{},"applied_money":{},"applied_taxes":[{}],"calculation_phase":"","catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","taxable":false,"total_money":{},"total_tax_money":{},"type":"","uid":""}],"source":{"name":""},"state":"","taxes":[{"applied_money":{},"auto_applied":false,"catalog_object_id":"","catalog_version":0,"metadata":{},"name":"","percentage":"","scope":"","type":"","uid":""}],"tenders":[{"additional_recipients":[{}],"amount_money":{},"card_details":{"card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"entry_method":"","status":""},"cash_details":{"buyer_tendered_money":{},"change_back_money":{}},"created_at":"","customer_id":"","id":"","location_id":"","note":"","payment_id":"","processing_fee_money":{},"tip_money":{},"transaction_id":"","type":""}],"total_discount_money":{},"total_money":{},"total_service_charge_money":{},"total_tax_money":{},"total_tip_money":{},"updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"fields_to_clear": @[ ],
@"idempotency_key": @"",
@"order": @{ @"closed_at": @"", @"created_at": @"", @"customer_id": @"", @"discounts": @[ @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"pricing_rule_id": @"", @"reward_ids": @[ ], @"scope": @"", @"type": @"", @"uid": @"" } ], @"fulfillments": @[ @{ @"metadata": @{ }, @"pickup_details": @{ @"accepted_at": @"", @"auto_complete_duration": @"", @"cancel_reason": @"", @"canceled_at": @"", @"curbside_pickup_details": @{ @"buyer_arrived_at": @"", @"curbside_details": @"" }, @"expired_at": @"", @"expires_at": @"", @"is_curbside_pickup": @NO, @"note": @"", @"picked_up_at": @"", @"pickup_at": @"", @"pickup_window_duration": @"", @"placed_at": @"", @"prep_time_duration": @"", @"ready_at": @"", @"recipient": @{ @"address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"customer_id": @"", @"display_name": @"", @"email_address": @"", @"phone_number": @"" }, @"rejected_at": @"", @"schedule_type": @"" }, @"shipment_details": @{ @"cancel_reason": @"", @"canceled_at": @"", @"carrier": @"", @"expected_shipped_at": @"", @"failed_at": @"", @"failure_reason": @"", @"in_progress_at": @"", @"packaged_at": @"", @"placed_at": @"", @"recipient": @{ }, @"shipped_at": @"", @"shipping_note": @"", @"shipping_type": @"", @"tracking_number": @"", @"tracking_url": @"" }, @"state": @"", @"type": @"", @"uid": @"" } ], @"id": @"", @"line_items": @[ @{ @"applied_discounts": @[ @{ @"applied_money": @{ }, @"discount_uid": @"", @"uid": @"" } ], @"applied_taxes": @[ @{ @"applied_money": @{ }, @"tax_uid": @"", @"uid": @"" } ], @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"gross_sales_money": @{ }, @"item_type": @"", @"metadata": @{ }, @"modifiers": @[ @{ @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"total_price_money": @{ }, @"uid": @"" } ], @"name": @"", @"note": @"", @"pricing_blocklists": @{ @"blocked_discounts": @[ @{ @"discount_catalog_object_id": @"", @"discount_uid": @"", @"uid": @"" } ], @"blocked_taxes": @[ @{ @"tax_catalog_object_id": @"", @"tax_uid": @"", @"uid": @"" } ] }, @"quantity": @"", @"quantity_unit": @{ @"catalog_version": @0, @"measurement_unit": @{ @"area_unit": @"", @"custom_unit": @{ @"abbreviation": @"", @"name": @"" }, @"generic_unit": @"", @"length_unit": @"", @"time_unit": @"", @"type": @"", @"volume_unit": @"", @"weight_unit": @"" }, @"precision": @0 }, @"total_discount_money": @{ }, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"", @"variation_name": @"", @"variation_total_price_money": @{ } } ], @"location_id": @"", @"metadata": @{ }, @"net_amounts": @{ @"discount_money": @{ }, @"service_charge_money": @{ }, @"tax_money": @{ }, @"tip_money": @{ }, @"total_money": @{ } }, @"pricing_options": @{ @"auto_apply_discounts": @NO, @"auto_apply_taxes": @NO }, @"reference_id": @"", @"refunds": @[ @{ @"additional_recipients": @[ @{ @"amount_money": @{ }, @"description": @"", @"location_id": @"", @"receivable_id": @"" } ], @"amount_money": @{ }, @"created_at": @"", @"id": @"", @"location_id": @"", @"processing_fee_money": @{ }, @"reason": @"", @"status": @"", @"tender_id": @"", @"transaction_id": @"" } ], @"return_amounts": @{ }, @"returns": @[ @{ @"return_amounts": @{ }, @"return_discounts": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"scope": @"", @"source_discount_uid": @"", @"type": @"", @"uid": @"" } ], @"return_line_items": @[ @{ @"applied_discounts": @[ @{ } ], @"applied_taxes": @[ @{ } ], @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"gross_return_money": @{ }, @"item_type": @"", @"name": @"", @"note": @"", @"quantity": @"", @"quantity_unit": @{ }, @"return_modifiers": @[ @{ @"base_price_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"source_modifier_uid": @"", @"total_price_money": @{ }, @"uid": @"" } ], @"source_line_item_uid": @"", @"total_discount_money": @{ }, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"", @"variation_name": @"", @"variation_total_price_money": @{ } } ], @"return_service_charges": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"applied_taxes": @[ @{ } ], @"calculation_phase": @"", @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"source_service_charge_uid": @"", @"taxable": @NO, @"total_money": @{ }, @"total_tax_money": @{ }, @"uid": @"" } ], @"return_taxes": @[ @{ @"applied_money": @{ }, @"catalog_object_id": @"", @"catalog_version": @0, @"name": @"", @"percentage": @"", @"scope": @"", @"source_tax_uid": @"", @"type": @"", @"uid": @"" } ], @"rounding_adjustment": @{ @"amount_money": @{ }, @"name": @"", @"uid": @"" }, @"source_order_id": @"", @"uid": @"" } ], @"rewards": @[ @{ @"id": @"", @"reward_tier_id": @"" } ], @"rounding_adjustment": @{ }, @"service_charges": @[ @{ @"amount_money": @{ }, @"applied_money": @{ }, @"applied_taxes": @[ @{ } ], @"calculation_phase": @"", @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"taxable": @NO, @"total_money": @{ }, @"total_tax_money": @{ }, @"type": @"", @"uid": @"" } ], @"source": @{ @"name": @"" }, @"state": @"", @"taxes": @[ @{ @"applied_money": @{ }, @"auto_applied": @NO, @"catalog_object_id": @"", @"catalog_version": @0, @"metadata": @{ }, @"name": @"", @"percentage": @"", @"scope": @"", @"type": @"", @"uid": @"" } ], @"tenders": @[ @{ @"additional_recipients": @[ @{ } ], @"amount_money": @{ }, @"card_details": @{ @"card": @{ @"billing_address": @{ }, @"bin": @"", @"card_brand": @"", @"card_type": @"", @"cardholder_name": @"", @"customer_id": @"", @"enabled": @NO, @"exp_month": @0, @"exp_year": @0, @"fingerprint": @"", @"id": @"", @"last_4": @"", @"prepaid_type": @"", @"reference_id": @"", @"version": @0 }, @"entry_method": @"", @"status": @"" }, @"cash_details": @{ @"buyer_tendered_money": @{ }, @"change_back_money": @{ } }, @"created_at": @"", @"customer_id": @"", @"id": @"", @"location_id": @"", @"note": @"", @"payment_id": @"", @"processing_fee_money": @{ }, @"tip_money": @{ }, @"transaction_id": @"", @"type": @"" } ], @"total_discount_money": @{ }, @"total_money": @{ }, @"total_service_charge_money": @{ }, @"total_tax_money": @{ }, @"total_tip_money": @{ }, @"updated_at": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/orders/:order_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/orders/:order_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/orders/:order_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'fields_to_clear' => [
],
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/orders/:order_id', [
'body' => '{
"fields_to_clear": [],
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/orders/:order_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'fields_to_clear' => [
],
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'fields_to_clear' => [
],
'idempotency_key' => '',
'order' => [
'closed_at' => '',
'created_at' => '',
'customer_id' => '',
'discounts' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'pricing_rule_id' => '',
'reward_ids' => [
],
'scope' => '',
'type' => '',
'uid' => ''
]
],
'fulfillments' => [
[
'metadata' => [
],
'pickup_details' => [
'accepted_at' => '',
'auto_complete_duration' => '',
'cancel_reason' => '',
'canceled_at' => '',
'curbside_pickup_details' => [
'buyer_arrived_at' => '',
'curbside_details' => ''
],
'expired_at' => '',
'expires_at' => '',
'is_curbside_pickup' => null,
'note' => '',
'picked_up_at' => '',
'pickup_at' => '',
'pickup_window_duration' => '',
'placed_at' => '',
'prep_time_duration' => '',
'ready_at' => '',
'recipient' => [
'address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'customer_id' => '',
'display_name' => '',
'email_address' => '',
'phone_number' => ''
],
'rejected_at' => '',
'schedule_type' => ''
],
'shipment_details' => [
'cancel_reason' => '',
'canceled_at' => '',
'carrier' => '',
'expected_shipped_at' => '',
'failed_at' => '',
'failure_reason' => '',
'in_progress_at' => '',
'packaged_at' => '',
'placed_at' => '',
'recipient' => [
],
'shipped_at' => '',
'shipping_note' => '',
'shipping_type' => '',
'tracking_number' => '',
'tracking_url' => ''
],
'state' => '',
'type' => '',
'uid' => ''
]
],
'id' => '',
'line_items' => [
[
'applied_discounts' => [
[
'applied_money' => [
],
'discount_uid' => '',
'uid' => ''
]
],
'applied_taxes' => [
[
'applied_money' => [
],
'tax_uid' => '',
'uid' => ''
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_sales_money' => [
],
'item_type' => '',
'metadata' => [
],
'modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'name' => '',
'note' => '',
'pricing_blocklists' => [
'blocked_discounts' => [
[
'discount_catalog_object_id' => '',
'discount_uid' => '',
'uid' => ''
]
],
'blocked_taxes' => [
[
'tax_catalog_object_id' => '',
'tax_uid' => '',
'uid' => ''
]
]
],
'quantity' => '',
'quantity_unit' => [
'catalog_version' => 0,
'measurement_unit' => [
'area_unit' => '',
'custom_unit' => [
'abbreviation' => '',
'name' => ''
],
'generic_unit' => '',
'length_unit' => '',
'time_unit' => '',
'type' => '',
'volume_unit' => '',
'weight_unit' => ''
],
'precision' => 0
],
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'location_id' => '',
'metadata' => [
],
'net_amounts' => [
'discount_money' => [
],
'service_charge_money' => [
],
'tax_money' => [
],
'tip_money' => [
],
'total_money' => [
]
],
'pricing_options' => [
'auto_apply_discounts' => null,
'auto_apply_taxes' => null
],
'reference_id' => '',
'refunds' => [
[
'additional_recipients' => [
[
'amount_money' => [
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'created_at' => '',
'id' => '',
'location_id' => '',
'processing_fee_money' => [
],
'reason' => '',
'status' => '',
'tender_id' => '',
'transaction_id' => ''
]
],
'return_amounts' => [
],
'returns' => [
[
'return_amounts' => [
],
'return_discounts' => [
[
'amount_money' => [
],
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_discount_uid' => '',
'type' => '',
'uid' => ''
]
],
'return_line_items' => [
[
'applied_discounts' => [
[
]
],
'applied_taxes' => [
[
]
],
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'gross_return_money' => [
],
'item_type' => '',
'name' => '',
'note' => '',
'quantity' => '',
'quantity_unit' => [
],
'return_modifiers' => [
[
'base_price_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'source_modifier_uid' => '',
'total_price_money' => [
],
'uid' => ''
]
],
'source_line_item_uid' => '',
'total_discount_money' => [
],
'total_money' => [
],
'total_tax_money' => [
],
'uid' => '',
'variation_name' => '',
'variation_total_price_money' => [
]
]
],
'return_service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'source_service_charge_uid' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'uid' => ''
]
],
'return_taxes' => [
[
'applied_money' => [
],
'catalog_object_id' => '',
'catalog_version' => 0,
'name' => '',
'percentage' => '',
'scope' => '',
'source_tax_uid' => '',
'type' => '',
'uid' => ''
]
],
'rounding_adjustment' => [
'amount_money' => [
],
'name' => '',
'uid' => ''
],
'source_order_id' => '',
'uid' => ''
]
],
'rewards' => [
[
'id' => '',
'reward_tier_id' => ''
]
],
'rounding_adjustment' => [
],
'service_charges' => [
[
'amount_money' => [
],
'applied_money' => [
],
'applied_taxes' => [
[
]
],
'calculation_phase' => '',
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'taxable' => null,
'total_money' => [
],
'total_tax_money' => [
],
'type' => '',
'uid' => ''
]
],
'source' => [
'name' => ''
],
'state' => '',
'taxes' => [
[
'applied_money' => [
],
'auto_applied' => null,
'catalog_object_id' => '',
'catalog_version' => 0,
'metadata' => [
],
'name' => '',
'percentage' => '',
'scope' => '',
'type' => '',
'uid' => ''
]
],
'tenders' => [
[
'additional_recipients' => [
[
]
],
'amount_money' => [
],
'card_details' => [
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'entry_method' => '',
'status' => ''
],
'cash_details' => [
'buyer_tendered_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'id' => '',
'location_id' => '',
'note' => '',
'payment_id' => '',
'processing_fee_money' => [
],
'tip_money' => [
],
'transaction_id' => '',
'type' => ''
]
],
'total_discount_money' => [
],
'total_money' => [
],
'total_service_charge_money' => [
],
'total_tax_money' => [
],
'total_tip_money' => [
],
'updated_at' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/orders/:order_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/orders/:order_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"fields_to_clear": [],
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/orders/:order_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"fields_to_clear": [],
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/orders/:order_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/orders/:order_id"
payload = {
"fields_to_clear": [],
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": False,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": False,
"auto_apply_taxes": False
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [{}],
"applied_taxes": [{}],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [{}],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": False,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [{}],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": False,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": { "name": "" },
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": False,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [{}],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": False,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/orders/:order_id"
payload <- "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/orders/:order_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/orders/:order_id') do |req|
req.body = "{\n \"fields_to_clear\": [],\n \"idempotency_key\": \"\",\n \"order\": {\n \"closed_at\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"discounts\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"pricing_rule_id\": \"\",\n \"reward_ids\": [],\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"fulfillments\": [\n {\n \"metadata\": {},\n \"pickup_details\": {\n \"accepted_at\": \"\",\n \"auto_complete_duration\": \"\",\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"curbside_pickup_details\": {\n \"buyer_arrived_at\": \"\",\n \"curbside_details\": \"\"\n },\n \"expired_at\": \"\",\n \"expires_at\": \"\",\n \"is_curbside_pickup\": false,\n \"note\": \"\",\n \"picked_up_at\": \"\",\n \"pickup_at\": \"\",\n \"pickup_window_duration\": \"\",\n \"placed_at\": \"\",\n \"prep_time_duration\": \"\",\n \"ready_at\": \"\",\n \"recipient\": {\n \"address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"customer_id\": \"\",\n \"display_name\": \"\",\n \"email_address\": \"\",\n \"phone_number\": \"\"\n },\n \"rejected_at\": \"\",\n \"schedule_type\": \"\"\n },\n \"shipment_details\": {\n \"cancel_reason\": \"\",\n \"canceled_at\": \"\",\n \"carrier\": \"\",\n \"expected_shipped_at\": \"\",\n \"failed_at\": \"\",\n \"failure_reason\": \"\",\n \"in_progress_at\": \"\",\n \"packaged_at\": \"\",\n \"placed_at\": \"\",\n \"recipient\": {},\n \"shipped_at\": \"\",\n \"shipping_note\": \"\",\n \"shipping_type\": \"\",\n \"tracking_number\": \"\",\n \"tracking_url\": \"\"\n },\n \"state\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"id\": \"\",\n \"line_items\": [\n {\n \"applied_discounts\": [\n {\n \"applied_money\": {},\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"applied_taxes\": [\n {\n \"applied_money\": {},\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_sales_money\": {},\n \"item_type\": \"\",\n \"metadata\": {},\n \"modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"name\": \"\",\n \"note\": \"\",\n \"pricing_blocklists\": {\n \"blocked_discounts\": [\n {\n \"discount_catalog_object_id\": \"\",\n \"discount_uid\": \"\",\n \"uid\": \"\"\n }\n ],\n \"blocked_taxes\": [\n {\n \"tax_catalog_object_id\": \"\",\n \"tax_uid\": \"\",\n \"uid\": \"\"\n }\n ]\n },\n \"quantity\": \"\",\n \"quantity_unit\": {\n \"catalog_version\": 0,\n \"measurement_unit\": {\n \"area_unit\": \"\",\n \"custom_unit\": {\n \"abbreviation\": \"\",\n \"name\": \"\"\n },\n \"generic_unit\": \"\",\n \"length_unit\": \"\",\n \"time_unit\": \"\",\n \"type\": \"\",\n \"volume_unit\": \"\",\n \"weight_unit\": \"\"\n },\n \"precision\": 0\n },\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"location_id\": \"\",\n \"metadata\": {},\n \"net_amounts\": {\n \"discount_money\": {},\n \"service_charge_money\": {},\n \"tax_money\": {},\n \"tip_money\": {},\n \"total_money\": {}\n },\n \"pricing_options\": {\n \"auto_apply_discounts\": false,\n \"auto_apply_taxes\": false\n },\n \"reference_id\": \"\",\n \"refunds\": [\n {\n \"additional_recipients\": [\n {\n \"amount_money\": {},\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"created_at\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"processing_fee_money\": {},\n \"reason\": \"\",\n \"status\": \"\",\n \"tender_id\": \"\",\n \"transaction_id\": \"\"\n }\n ],\n \"return_amounts\": {},\n \"returns\": [\n {\n \"return_amounts\": {},\n \"return_discounts\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_discount_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"return_line_items\": [\n {\n \"applied_discounts\": [\n {}\n ],\n \"applied_taxes\": [\n {}\n ],\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"gross_return_money\": {},\n \"item_type\": \"\",\n \"name\": \"\",\n \"note\": \"\",\n \"quantity\": \"\",\n \"quantity_unit\": {},\n \"return_modifiers\": [\n {\n \"base_price_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"source_modifier_uid\": \"\",\n \"total_price_money\": {},\n \"uid\": \"\"\n }\n ],\n \"source_line_item_uid\": \"\",\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\",\n \"variation_name\": \"\",\n \"variation_total_price_money\": {}\n }\n ],\n \"return_service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"source_service_charge_uid\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"uid\": \"\"\n }\n ],\n \"return_taxes\": [\n {\n \"applied_money\": {},\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"source_tax_uid\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rounding_adjustment\": {\n \"amount_money\": {},\n \"name\": \"\",\n \"uid\": \"\"\n },\n \"source_order_id\": \"\",\n \"uid\": \"\"\n }\n ],\n \"rewards\": [\n {\n \"id\": \"\",\n \"reward_tier_id\": \"\"\n }\n ],\n \"rounding_adjustment\": {},\n \"service_charges\": [\n {\n \"amount_money\": {},\n \"applied_money\": {},\n \"applied_taxes\": [\n {}\n ],\n \"calculation_phase\": \"\",\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"taxable\": false,\n \"total_money\": {},\n \"total_tax_money\": {},\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"source\": {\n \"name\": \"\"\n },\n \"state\": \"\",\n \"taxes\": [\n {\n \"applied_money\": {},\n \"auto_applied\": false,\n \"catalog_object_id\": \"\",\n \"catalog_version\": 0,\n \"metadata\": {},\n \"name\": \"\",\n \"percentage\": \"\",\n \"scope\": \"\",\n \"type\": \"\",\n \"uid\": \"\"\n }\n ],\n \"tenders\": [\n {\n \"additional_recipients\": [\n {}\n ],\n \"amount_money\": {},\n \"card_details\": {\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"entry_method\": \"\",\n \"status\": \"\"\n },\n \"cash_details\": {\n \"buyer_tendered_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_id\": \"\",\n \"processing_fee_money\": {},\n \"tip_money\": {},\n \"transaction_id\": \"\",\n \"type\": \"\"\n }\n ],\n \"total_discount_money\": {},\n \"total_money\": {},\n \"total_service_charge_money\": {},\n \"total_tax_money\": {},\n \"total_tip_money\": {},\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/orders/:order_id";
let payload = json!({
"fields_to_clear": (),
"idempotency_key": "",
"order": json!({
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": (
json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": (),
"scope": "",
"type": "",
"uid": ""
})
),
"fulfillments": (
json!({
"metadata": json!({}),
"pickup_details": json!({
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": json!({
"buyer_arrived_at": "",
"curbside_details": ""
}),
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": json!({
"address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
}),
"rejected_at": "",
"schedule_type": ""
}),
"shipment_details": json!({
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": json!({}),
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
}),
"state": "",
"type": "",
"uid": ""
})
),
"id": "",
"line_items": (
json!({
"applied_discounts": (
json!({
"applied_money": json!({}),
"discount_uid": "",
"uid": ""
})
),
"applied_taxes": (
json!({
"applied_money": json!({}),
"tax_uid": "",
"uid": ""
})
),
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": json!({}),
"item_type": "",
"metadata": json!({}),
"modifiers": (
json!({
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": json!({}),
"uid": ""
})
),
"name": "",
"note": "",
"pricing_blocklists": json!({
"blocked_discounts": (
json!({
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
})
),
"blocked_taxes": (
json!({
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
})
)
}),
"quantity": "",
"quantity_unit": json!({
"catalog_version": 0,
"measurement_unit": json!({
"area_unit": "",
"custom_unit": json!({
"abbreviation": "",
"name": ""
}),
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
}),
"precision": 0
}),
"total_discount_money": json!({}),
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": "",
"variation_name": "",
"variation_total_price_money": json!({})
})
),
"location_id": "",
"metadata": json!({}),
"net_amounts": json!({
"discount_money": json!({}),
"service_charge_money": json!({}),
"tax_money": json!({}),
"tip_money": json!({}),
"total_money": json!({})
}),
"pricing_options": json!({
"auto_apply_discounts": false,
"auto_apply_taxes": false
}),
"reference_id": "",
"refunds": (
json!({
"additional_recipients": (
json!({
"amount_money": json!({}),
"description": "",
"location_id": "",
"receivable_id": ""
})
),
"amount_money": json!({}),
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": json!({}),
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
})
),
"return_amounts": json!({}),
"returns": (
json!({
"return_amounts": json!({}),
"return_discounts": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
})
),
"return_line_items": (
json!({
"applied_discounts": (json!({})),
"applied_taxes": (json!({})),
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": json!({}),
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": json!({}),
"return_modifiers": (
json!({
"base_price_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": json!({}),
"uid": ""
})
),
"source_line_item_uid": "",
"total_discount_money": json!({}),
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": "",
"variation_name": "",
"variation_total_price_money": json!({})
})
),
"return_service_charges": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"applied_taxes": (json!({})),
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": json!({}),
"total_tax_money": json!({}),
"uid": ""
})
),
"return_taxes": (
json!({
"applied_money": json!({}),
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
})
),
"rounding_adjustment": json!({
"amount_money": json!({}),
"name": "",
"uid": ""
}),
"source_order_id": "",
"uid": ""
})
),
"rewards": (
json!({
"id": "",
"reward_tier_id": ""
})
),
"rounding_adjustment": json!({}),
"service_charges": (
json!({
"amount_money": json!({}),
"applied_money": json!({}),
"applied_taxes": (json!({})),
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"taxable": false,
"total_money": json!({}),
"total_tax_money": json!({}),
"type": "",
"uid": ""
})
),
"source": json!({"name": ""}),
"state": "",
"taxes": (
json!({
"applied_money": json!({}),
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": json!({}),
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
})
),
"tenders": (
json!({
"additional_recipients": (json!({})),
"amount_money": json!({}),
"card_details": json!({
"card": json!({
"billing_address": json!({}),
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
}),
"entry_method": "",
"status": ""
}),
"cash_details": json!({
"buyer_tendered_money": json!({}),
"change_back_money": json!({})
}),
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": json!({}),
"tip_money": json!({}),
"transaction_id": "",
"type": ""
})
),
"total_discount_money": json!({}),
"total_money": json!({}),
"total_service_charge_money": json!({}),
"total_tax_money": json!({}),
"total_tip_money": json!({}),
"updated_at": "",
"version": 0
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/orders/:order_id \
--header 'content-type: application/json' \
--data '{
"fields_to_clear": [],
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}'
echo '{
"fields_to_clear": [],
"idempotency_key": "",
"order": {
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
}
],
"fulfillments": [
{
"metadata": {},
"pickup_details": {
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": {
"buyer_arrived_at": "",
"curbside_details": ""
},
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": {
"address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
},
"rejected_at": "",
"schedule_type": ""
},
"shipment_details": {
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": {},
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
},
"state": "",
"type": "",
"uid": ""
}
],
"id": "",
"line_items": [
{
"applied_discounts": [
{
"applied_money": {},
"discount_uid": "",
"uid": ""
}
],
"applied_taxes": [
{
"applied_money": {},
"tax_uid": "",
"uid": ""
}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": {},
"item_type": "",
"metadata": {},
"modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": {},
"uid": ""
}
],
"name": "",
"note": "",
"pricing_blocklists": {
"blocked_discounts": [
{
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
}
],
"blocked_taxes": [
{
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
}
]
},
"quantity": "",
"quantity_unit": {
"catalog_version": 0,
"measurement_unit": {
"area_unit": "",
"custom_unit": {
"abbreviation": "",
"name": ""
},
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
},
"precision": 0
},
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"location_id": "",
"metadata": {},
"net_amounts": {
"discount_money": {},
"service_charge_money": {},
"tax_money": {},
"tip_money": {},
"total_money": {}
},
"pricing_options": {
"auto_apply_discounts": false,
"auto_apply_taxes": false
},
"reference_id": "",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": {},
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
}
],
"return_amounts": {},
"returns": [
{
"return_amounts": {},
"return_discounts": [
{
"amount_money": {},
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
}
],
"return_line_items": [
{
"applied_discounts": [
{}
],
"applied_taxes": [
{}
],
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": {},
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": {},
"return_modifiers": [
{
"base_price_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": {},
"uid": ""
}
],
"source_line_item_uid": "",
"total_discount_money": {},
"total_money": {},
"total_tax_money": {},
"uid": "",
"variation_name": "",
"variation_total_price_money": {}
}
],
"return_service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"uid": ""
}
],
"return_taxes": [
{
"applied_money": {},
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
}
],
"rounding_adjustment": {
"amount_money": {},
"name": "",
"uid": ""
},
"source_order_id": "",
"uid": ""
}
],
"rewards": [
{
"id": "",
"reward_tier_id": ""
}
],
"rounding_adjustment": {},
"service_charges": [
{
"amount_money": {},
"applied_money": {},
"applied_taxes": [
{}
],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"taxable": false,
"total_money": {},
"total_tax_money": {},
"type": "",
"uid": ""
}
],
"source": {
"name": ""
},
"state": "",
"taxes": [
{
"applied_money": {},
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": {},
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
}
],
"tenders": [
{
"additional_recipients": [
{}
],
"amount_money": {},
"card_details": {
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"entry_method": "",
"status": ""
},
"cash_details": {
"buyer_tendered_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": {},
"tip_money": {},
"transaction_id": "",
"type": ""
}
],
"total_discount_money": {},
"total_money": {},
"total_service_charge_money": {},
"total_tax_money": {},
"total_tip_money": {},
"updated_at": "",
"version": 0
}
}' | \
http PUT {{baseUrl}}/v2/orders/:order_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "fields_to_clear": [],\n "idempotency_key": "",\n "order": {\n "closed_at": "",\n "created_at": "",\n "customer_id": "",\n "discounts": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "pricing_rule_id": "",\n "reward_ids": [],\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "fulfillments": [\n {\n "metadata": {},\n "pickup_details": {\n "accepted_at": "",\n "auto_complete_duration": "",\n "cancel_reason": "",\n "canceled_at": "",\n "curbside_pickup_details": {\n "buyer_arrived_at": "",\n "curbside_details": ""\n },\n "expired_at": "",\n "expires_at": "",\n "is_curbside_pickup": false,\n "note": "",\n "picked_up_at": "",\n "pickup_at": "",\n "pickup_window_duration": "",\n "placed_at": "",\n "prep_time_duration": "",\n "ready_at": "",\n "recipient": {\n "address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "customer_id": "",\n "display_name": "",\n "email_address": "",\n "phone_number": ""\n },\n "rejected_at": "",\n "schedule_type": ""\n },\n "shipment_details": {\n "cancel_reason": "",\n "canceled_at": "",\n "carrier": "",\n "expected_shipped_at": "",\n "failed_at": "",\n "failure_reason": "",\n "in_progress_at": "",\n "packaged_at": "",\n "placed_at": "",\n "recipient": {},\n "shipped_at": "",\n "shipping_note": "",\n "shipping_type": "",\n "tracking_number": "",\n "tracking_url": ""\n },\n "state": "",\n "type": "",\n "uid": ""\n }\n ],\n "id": "",\n "line_items": [\n {\n "applied_discounts": [\n {\n "applied_money": {},\n "discount_uid": "",\n "uid": ""\n }\n ],\n "applied_taxes": [\n {\n "applied_money": {},\n "tax_uid": "",\n "uid": ""\n }\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_sales_money": {},\n "item_type": "",\n "metadata": {},\n "modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "name": "",\n "note": "",\n "pricing_blocklists": {\n "blocked_discounts": [\n {\n "discount_catalog_object_id": "",\n "discount_uid": "",\n "uid": ""\n }\n ],\n "blocked_taxes": [\n {\n "tax_catalog_object_id": "",\n "tax_uid": "",\n "uid": ""\n }\n ]\n },\n "quantity": "",\n "quantity_unit": {\n "catalog_version": 0,\n "measurement_unit": {\n "area_unit": "",\n "custom_unit": {\n "abbreviation": "",\n "name": ""\n },\n "generic_unit": "",\n "length_unit": "",\n "time_unit": "",\n "type": "",\n "volume_unit": "",\n "weight_unit": ""\n },\n "precision": 0\n },\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "location_id": "",\n "metadata": {},\n "net_amounts": {\n "discount_money": {},\n "service_charge_money": {},\n "tax_money": {},\n "tip_money": {},\n "total_money": {}\n },\n "pricing_options": {\n "auto_apply_discounts": false,\n "auto_apply_taxes": false\n },\n "reference_id": "",\n "refunds": [\n {\n "additional_recipients": [\n {\n "amount_money": {},\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "created_at": "",\n "id": "",\n "location_id": "",\n "processing_fee_money": {},\n "reason": "",\n "status": "",\n "tender_id": "",\n "transaction_id": ""\n }\n ],\n "return_amounts": {},\n "returns": [\n {\n "return_amounts": {},\n "return_discounts": [\n {\n "amount_money": {},\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_discount_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "return_line_items": [\n {\n "applied_discounts": [\n {}\n ],\n "applied_taxes": [\n {}\n ],\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "gross_return_money": {},\n "item_type": "",\n "name": "",\n "note": "",\n "quantity": "",\n "quantity_unit": {},\n "return_modifiers": [\n {\n "base_price_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "source_modifier_uid": "",\n "total_price_money": {},\n "uid": ""\n }\n ],\n "source_line_item_uid": "",\n "total_discount_money": {},\n "total_money": {},\n "total_tax_money": {},\n "uid": "",\n "variation_name": "",\n "variation_total_price_money": {}\n }\n ],\n "return_service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "source_service_charge_uid": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "uid": ""\n }\n ],\n "return_taxes": [\n {\n "applied_money": {},\n "catalog_object_id": "",\n "catalog_version": 0,\n "name": "",\n "percentage": "",\n "scope": "",\n "source_tax_uid": "",\n "type": "",\n "uid": ""\n }\n ],\n "rounding_adjustment": {\n "amount_money": {},\n "name": "",\n "uid": ""\n },\n "source_order_id": "",\n "uid": ""\n }\n ],\n "rewards": [\n {\n "id": "",\n "reward_tier_id": ""\n }\n ],\n "rounding_adjustment": {},\n "service_charges": [\n {\n "amount_money": {},\n "applied_money": {},\n "applied_taxes": [\n {}\n ],\n "calculation_phase": "",\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "taxable": false,\n "total_money": {},\n "total_tax_money": {},\n "type": "",\n "uid": ""\n }\n ],\n "source": {\n "name": ""\n },\n "state": "",\n "taxes": [\n {\n "applied_money": {},\n "auto_applied": false,\n "catalog_object_id": "",\n "catalog_version": 0,\n "metadata": {},\n "name": "",\n "percentage": "",\n "scope": "",\n "type": "",\n "uid": ""\n }\n ],\n "tenders": [\n {\n "additional_recipients": [\n {}\n ],\n "amount_money": {},\n "card_details": {\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "entry_method": "",\n "status": ""\n },\n "cash_details": {\n "buyer_tendered_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "id": "",\n "location_id": "",\n "note": "",\n "payment_id": "",\n "processing_fee_money": {},\n "tip_money": {},\n "transaction_id": "",\n "type": ""\n }\n ],\n "total_discount_money": {},\n "total_money": {},\n "total_service_charge_money": {},\n "total_tax_money": {},\n "total_tip_money": {},\n "updated_at": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/orders/:order_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"fields_to_clear": [],
"idempotency_key": "",
"order": [
"closed_at": "",
"created_at": "",
"customer_id": "",
"discounts": [
[
"amount_money": [
"amount": 0,
"currency": ""
],
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"pricing_rule_id": "",
"reward_ids": [],
"scope": "",
"type": "",
"uid": ""
]
],
"fulfillments": [
[
"metadata": [],
"pickup_details": [
"accepted_at": "",
"auto_complete_duration": "",
"cancel_reason": "",
"canceled_at": "",
"curbside_pickup_details": [
"buyer_arrived_at": "",
"curbside_details": ""
],
"expired_at": "",
"expires_at": "",
"is_curbside_pickup": false,
"note": "",
"picked_up_at": "",
"pickup_at": "",
"pickup_window_duration": "",
"placed_at": "",
"prep_time_duration": "",
"ready_at": "",
"recipient": [
"address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"customer_id": "",
"display_name": "",
"email_address": "",
"phone_number": ""
],
"rejected_at": "",
"schedule_type": ""
],
"shipment_details": [
"cancel_reason": "",
"canceled_at": "",
"carrier": "",
"expected_shipped_at": "",
"failed_at": "",
"failure_reason": "",
"in_progress_at": "",
"packaged_at": "",
"placed_at": "",
"recipient": [],
"shipped_at": "",
"shipping_note": "",
"shipping_type": "",
"tracking_number": "",
"tracking_url": ""
],
"state": "",
"type": "",
"uid": ""
]
],
"id": "",
"line_items": [
[
"applied_discounts": [
[
"applied_money": [],
"discount_uid": "",
"uid": ""
]
],
"applied_taxes": [
[
"applied_money": [],
"tax_uid": "",
"uid": ""
]
],
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"gross_sales_money": [],
"item_type": "",
"metadata": [],
"modifiers": [
[
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"total_price_money": [],
"uid": ""
]
],
"name": "",
"note": "",
"pricing_blocklists": [
"blocked_discounts": [
[
"discount_catalog_object_id": "",
"discount_uid": "",
"uid": ""
]
],
"blocked_taxes": [
[
"tax_catalog_object_id": "",
"tax_uid": "",
"uid": ""
]
]
],
"quantity": "",
"quantity_unit": [
"catalog_version": 0,
"measurement_unit": [
"area_unit": "",
"custom_unit": [
"abbreviation": "",
"name": ""
],
"generic_unit": "",
"length_unit": "",
"time_unit": "",
"type": "",
"volume_unit": "",
"weight_unit": ""
],
"precision": 0
],
"total_discount_money": [],
"total_money": [],
"total_tax_money": [],
"uid": "",
"variation_name": "",
"variation_total_price_money": []
]
],
"location_id": "",
"metadata": [],
"net_amounts": [
"discount_money": [],
"service_charge_money": [],
"tax_money": [],
"tip_money": [],
"total_money": []
],
"pricing_options": [
"auto_apply_discounts": false,
"auto_apply_taxes": false
],
"reference_id": "",
"refunds": [
[
"additional_recipients": [
[
"amount_money": [],
"description": "",
"location_id": "",
"receivable_id": ""
]
],
"amount_money": [],
"created_at": "",
"id": "",
"location_id": "",
"processing_fee_money": [],
"reason": "",
"status": "",
"tender_id": "",
"transaction_id": ""
]
],
"return_amounts": [],
"returns": [
[
"return_amounts": [],
"return_discounts": [
[
"amount_money": [],
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_discount_uid": "",
"type": "",
"uid": ""
]
],
"return_line_items": [
[
"applied_discounts": [[]],
"applied_taxes": [[]],
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"gross_return_money": [],
"item_type": "",
"name": "",
"note": "",
"quantity": "",
"quantity_unit": [],
"return_modifiers": [
[
"base_price_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"source_modifier_uid": "",
"total_price_money": [],
"uid": ""
]
],
"source_line_item_uid": "",
"total_discount_money": [],
"total_money": [],
"total_tax_money": [],
"uid": "",
"variation_name": "",
"variation_total_price_money": []
]
],
"return_service_charges": [
[
"amount_money": [],
"applied_money": [],
"applied_taxes": [[]],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"source_service_charge_uid": "",
"taxable": false,
"total_money": [],
"total_tax_money": [],
"uid": ""
]
],
"return_taxes": [
[
"applied_money": [],
"catalog_object_id": "",
"catalog_version": 0,
"name": "",
"percentage": "",
"scope": "",
"source_tax_uid": "",
"type": "",
"uid": ""
]
],
"rounding_adjustment": [
"amount_money": [],
"name": "",
"uid": ""
],
"source_order_id": "",
"uid": ""
]
],
"rewards": [
[
"id": "",
"reward_tier_id": ""
]
],
"rounding_adjustment": [],
"service_charges": [
[
"amount_money": [],
"applied_money": [],
"applied_taxes": [[]],
"calculation_phase": "",
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"taxable": false,
"total_money": [],
"total_tax_money": [],
"type": "",
"uid": ""
]
],
"source": ["name": ""],
"state": "",
"taxes": [
[
"applied_money": [],
"auto_applied": false,
"catalog_object_id": "",
"catalog_version": 0,
"metadata": [],
"name": "",
"percentage": "",
"scope": "",
"type": "",
"uid": ""
]
],
"tenders": [
[
"additional_recipients": [[]],
"amount_money": [],
"card_details": [
"card": [
"billing_address": [],
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
],
"entry_method": "",
"status": ""
],
"cash_details": [
"buyer_tendered_money": [],
"change_back_money": []
],
"created_at": "",
"customer_id": "",
"id": "",
"location_id": "",
"note": "",
"payment_id": "",
"processing_fee_money": [],
"tip_money": [],
"transaction_id": "",
"type": ""
]
],
"total_discount_money": [],
"total_money": [],
"total_service_charge_money": [],
"total_tax_money": [],
"total_tip_money": [],
"updated_at": "",
"version": 0
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/orders/:order_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"order": {
"created_at": "2019-08-23T18:26:18.243Z",
"id": "DREk7wJcyXNHqULq8JJ2iPAsluJZY",
"line_items": [
{
"base_price_money": {
"amount": 500,
"currency": "USD"
},
"gross_sales_money": {
"amount": 500,
"currency": "USD"
},
"name": "Small Coffee",
"quantity": "1",
"total_discount_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 500,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"uid": "EuYkakhmu3ksHIds5Hiot",
"variation_total_price_money": {
"amount": 500,
"currency": "USD"
}
},
{
"base_price_money": {
"amount": 200,
"currency": "USD"
},
"gross_sales_money": {
"amount": 400,
"currency": "USD"
},
"name": "COOKIE",
"quantity": "2",
"total_discount_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 400,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"uid": "cookie_uid",
"variation_total_price_money": {
"amount": 400,
"currency": "USD"
}
}
],
"location_id": "MXVQSVNDGN3C8",
"net_amounts": {
"discount_money": {
"amount": 0,
"currency": "USD"
},
"service_charge_money": {
"amount": 0,
"currency": "USD"
},
"tax_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 900,
"currency": "USD"
}
},
"source": {
"name": "Cookies"
},
"state": "OPEN",
"total_discount_money": {
"amount": 0,
"currency": "USD"
},
"total_money": {
"amount": 900,
"currency": "USD"
},
"total_service_charge_money": {
"amount": 0,
"currency": "USD"
},
"total_tax_money": {
"amount": 0,
"currency": "USD"
},
"updated_at": "2019-08-23T18:33:47.523Z",
"version": 2
}
}
POST
CancelPayment
{{baseUrl}}/v2/payments/:payment_id/cancel
QUERY PARAMS
payment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/payments/:payment_id/cancel");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/payments/:payment_id/cancel")
require "http/client"
url = "{{baseUrl}}/v2/payments/:payment_id/cancel"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/payments/:payment_id/cancel"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/payments/:payment_id/cancel");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/payments/:payment_id/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/payments/:payment_id/cancel HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/payments/:payment_id/cancel")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/payments/:payment_id/cancel"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/payments/:payment_id/cancel")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/payments/:payment_id/cancel")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/payments/:payment_id/cancel');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/:payment_id/cancel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/payments/:payment_id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/payments/:payment_id/cancel',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/payments/:payment_id/cancel")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/payments/:payment_id/cancel',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/:payment_id/cancel'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/payments/:payment_id/cancel');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/:payment_id/cancel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/payments/:payment_id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/payments/:payment_id/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/payments/:payment_id/cancel" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/payments/:payment_id/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/payments/:payment_id/cancel');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/payments/:payment_id/cancel');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/payments/:payment_id/cancel');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/payments/:payment_id/cancel' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/payments/:payment_id/cancel' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/payments/:payment_id/cancel")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/payments/:payment_id/cancel"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/payments/:payment_id/cancel"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/payments/:payment_id/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/payments/:payment_id/cancel') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/payments/:payment_id/cancel";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/payments/:payment_id/cancel
http POST {{baseUrl}}/v2/payments/:payment_id/cancel
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/payments/:payment_id/cancel
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/payments/:payment_id/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"payment": {
"amount_money": {
"amount": 200,
"currency": "USD"
},
"app_fee_money": {
"amount": 10,
"currency": "USD"
},
"approved_money": {
"amount": 200,
"currency": "USD"
},
"card_details": {
"auth_result_code": "eWZBDh",
"avs_status": "AVS_ACCEPTED",
"card": {
"bin": "411111",
"card_brand": "VISA",
"card_type": "DEBIT",
"exp_month": 2,
"exp_year": 2024,
"fingerprint": "sq-1-9PP0tWfcM6vIsYmfsesdjfhduHSDFNdJFNDfDNFjdfjpseirDErsaP",
"last_4": "1234",
"prepaid_type": "PREPAID"
},
"card_payment_timeline": {
"authorized_at": "2018-10-17T20:38:46.753Z",
"voided_at": "2018-10-17T20:38:57.793Z"
},
"cvv_status": "CVV_ACCEPTED",
"entry_method": "KEYED",
"statement_description": "SQ *MY MERCHANT",
"status": "VOIDED"
},
"created_at": "2018-10-17T20:38:46.743Z",
"customer_id": "RDX9Z4XTIZR7MRZJUXNY9HUK6I",
"id": "GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
"location_id": "XTI0H92143A39",
"note": "Brief description",
"order_id": "m2Hr8Hk8A3CTyQQ1k4ynExg92tO3",
"reference_id": "123456",
"source_type": "CARD",
"status": "CANCELED",
"total_money": {
"amount": 200,
"currency": "USD"
},
"updated_at": "2018-10-17T20:38:57.693Z",
"version_token": "lAITJ6l8I8tFu62mCf2W4sxJQxN9FOaH5zwfsdPf7Dm6o"
}
}
POST
CancelPaymentByIdempotencyKey
{{baseUrl}}/v2/payments/cancel
BODY json
{
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/payments/cancel");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/payments/cancel" {:content-type :json
:form-params {:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/payments/cancel"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/payments/cancel"),
Content = new StringContent("{\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/payments/cancel");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/payments/cancel"
payload := strings.NewReader("{\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/payments/cancel HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 27
{
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/payments/cancel")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/payments/cancel"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/payments/cancel")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/payments/cancel")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/payments/cancel');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/cancel',
headers: {'content-type': 'application/json'},
data: {idempotency_key: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/payments/cancel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/payments/cancel',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/payments/cancel")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/payments/cancel',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({idempotency_key: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/cancel',
headers: {'content-type': 'application/json'},
body: {idempotency_key: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/payments/cancel');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/cancel',
headers: {'content-type': 'application/json'},
data: {idempotency_key: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/payments/cancel';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/payments/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/payments/cancel" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/payments/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/payments/cancel', [
'body' => '{
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/payments/cancel');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/payments/cancel');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/payments/cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/payments/cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/payments/cancel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/payments/cancel"
payload = { "idempotency_key": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/payments/cancel"
payload <- "{\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/payments/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/payments/cancel') do |req|
req.body = "{\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/payments/cancel";
let payload = json!({"idempotency_key": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/payments/cancel \
--header 'content-type: application/json' \
--data '{
"idempotency_key": ""
}'
echo '{
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/payments/cancel \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/payments/cancel
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["idempotency_key": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/payments/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
POST
CompletePayment
{{baseUrl}}/v2/payments/:payment_id/complete
QUERY PARAMS
payment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/payments/:payment_id/complete");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/payments/:payment_id/complete")
require "http/client"
url = "{{baseUrl}}/v2/payments/:payment_id/complete"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/payments/:payment_id/complete"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/payments/:payment_id/complete");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/payments/:payment_id/complete"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/payments/:payment_id/complete HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/payments/:payment_id/complete")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/payments/:payment_id/complete"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/payments/:payment_id/complete")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/payments/:payment_id/complete")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/payments/:payment_id/complete');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/:payment_id/complete'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/payments/:payment_id/complete';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/payments/:payment_id/complete',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/payments/:payment_id/complete")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/payments/:payment_id/complete',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/:payment_id/complete'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/payments/:payment_id/complete');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments/:payment_id/complete'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/payments/:payment_id/complete';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/payments/:payment_id/complete"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/payments/:payment_id/complete" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/payments/:payment_id/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/payments/:payment_id/complete');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/payments/:payment_id/complete');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/payments/:payment_id/complete');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/payments/:payment_id/complete' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/payments/:payment_id/complete' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/payments/:payment_id/complete")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/payments/:payment_id/complete"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/payments/:payment_id/complete"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/payments/:payment_id/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/payments/:payment_id/complete') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/payments/:payment_id/complete";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/payments/:payment_id/complete
http POST {{baseUrl}}/v2/payments/:payment_id/complete
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/payments/:payment_id/complete
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/payments/:payment_id/complete")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"payment": {
"amount_money": {
"amount": 200,
"currency": "USD"
},
"app_fee_money": {
"amount": 10,
"currency": "USD"
},
"approved_money": {
"amount": 200,
"currency": "USD"
},
"card_details": {
"auth_result_code": "MhIjEN",
"avs_status": "AVS_ACCEPTED",
"card": {
"bin": "411111",
"card_brand": "VISA",
"card_type": "DEBIT",
"exp_month": 7,
"exp_year": 2026,
"fingerprint": "sq-1-TpmjbNBMFdibiIjpQI5LiRgNUBC7u1689i0TgHjnlyHEWYB7tnn-K4QbW4ttvtaqXw",
"last_4": "2796",
"prepaid_type": "PREPAID"
},
"card_payment_timeline": {
"authorized_at": "2019-07-10T13:23:49.234Z",
"captured_at": "2019-07-10T13:23:49.446Z"
},
"cvv_status": "CVV_ACCEPTED",
"entry_method": "ON_FILE",
"statement_description": "SQ *MY MERCHANT",
"status": "CAPTURED"
},
"created_at": "2019-07-10T13:39:55.317Z",
"customer_id": "RDX9Z4XTIZR7MRZJUXNY9HUK6I",
"id": "GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
"location_id": "XTI0H92143A39",
"note": "Brief description",
"order_id": "m2Hr8Hk8A3CTyQQ1k4ynExg92tO3",
"receipt_number": "GQTF",
"receipt_url": "https://squareup.com/receipt/preview/GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
"reference_id": "123456",
"source_type": "CARD",
"status": "COMPLETED",
"total_money": {
"amount": 200,
"currency": "USD"
},
"updated_at": "2019-07-10T13:40:05.982Z",
"version_token": "7knzZI16u3QBh2xXD7FH4GFwESqgam7Z9w2Ya0aSD9i6o"
}
}
POST
CreatePayment
{{baseUrl}}/v2/payments
BODY json
{
"accept_partial_authorization": false,
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"autocomplete": false,
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"customer_id": "",
"delay_duration": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"source_id": "",
"statement_description_identifier": "",
"tip_money": {},
"verification_token": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/payments");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/payments" {:content-type :json
:form-params {:accept_partial_authorization false
:amount_money {:amount 0
:currency ""}
:app_fee_money {}
:autocomplete false
:billing_address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:buyer_email_address ""
:cash_details {:buyer_supplied_money {}
:change_back_money {}}
:customer_id ""
:delay_duration ""
:external_details {:source ""
:source_fee_money {}
:source_id ""
:type ""}
:idempotency_key ""
:location_id ""
:note ""
:order_id ""
:reference_id ""
:shipping_address {}
:source_id ""
:statement_description_identifier ""
:tip_money {}
:verification_token ""}})
require "http/client"
url = "{{baseUrl}}/v2/payments"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/payments"),
Content = new StringContent("{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/payments");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/payments"
payload := strings.NewReader("{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/payments HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1092
{
"accept_partial_authorization": false,
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"autocomplete": false,
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"customer_id": "",
"delay_duration": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"source_id": "",
"statement_description_identifier": "",
"tip_money": {},
"verification_token": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/payments")
.setHeader("content-type", "application/json")
.setBody("{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/payments"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/payments")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/payments")
.header("content-type", "application/json")
.body("{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}")
.asString();
const data = JSON.stringify({
accept_partial_authorization: false,
amount_money: {
amount: 0,
currency: ''
},
app_fee_money: {},
autocomplete: false,
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
cash_details: {
buyer_supplied_money: {},
change_back_money: {}
},
customer_id: '',
delay_duration: '',
external_details: {
source: '',
source_fee_money: {},
source_id: '',
type: ''
},
idempotency_key: '',
location_id: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
source_id: '',
statement_description_identifier: '',
tip_money: {},
verification_token: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/payments');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments',
headers: {'content-type': 'application/json'},
data: {
accept_partial_authorization: false,
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
autocomplete: false,
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
cash_details: {buyer_supplied_money: {}, change_back_money: {}},
customer_id: '',
delay_duration: '',
external_details: {source: '', source_fee_money: {}, source_id: '', type: ''},
idempotency_key: '',
location_id: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
source_id: '',
statement_description_identifier: '',
tip_money: {},
verification_token: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/payments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"accept_partial_authorization":false,"amount_money":{"amount":0,"currency":""},"app_fee_money":{},"autocomplete":false,"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"buyer_email_address":"","cash_details":{"buyer_supplied_money":{},"change_back_money":{}},"customer_id":"","delay_duration":"","external_details":{"source":"","source_fee_money":{},"source_id":"","type":""},"idempotency_key":"","location_id":"","note":"","order_id":"","reference_id":"","shipping_address":{},"source_id":"","statement_description_identifier":"","tip_money":{},"verification_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/payments',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "accept_partial_authorization": false,\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_fee_money": {},\n "autocomplete": false,\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "buyer_email_address": "",\n "cash_details": {\n "buyer_supplied_money": {},\n "change_back_money": {}\n },\n "customer_id": "",\n "delay_duration": "",\n "external_details": {\n "source": "",\n "source_fee_money": {},\n "source_id": "",\n "type": ""\n },\n "idempotency_key": "",\n "location_id": "",\n "note": "",\n "order_id": "",\n "reference_id": "",\n "shipping_address": {},\n "source_id": "",\n "statement_description_identifier": "",\n "tip_money": {},\n "verification_token": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/payments")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/payments',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
accept_partial_authorization: false,
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
autocomplete: false,
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
cash_details: {buyer_supplied_money: {}, change_back_money: {}},
customer_id: '',
delay_duration: '',
external_details: {source: '', source_fee_money: {}, source_id: '', type: ''},
idempotency_key: '',
location_id: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
source_id: '',
statement_description_identifier: '',
tip_money: {},
verification_token: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments',
headers: {'content-type': 'application/json'},
body: {
accept_partial_authorization: false,
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
autocomplete: false,
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
cash_details: {buyer_supplied_money: {}, change_back_money: {}},
customer_id: '',
delay_duration: '',
external_details: {source: '', source_fee_money: {}, source_id: '', type: ''},
idempotency_key: '',
location_id: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
source_id: '',
statement_description_identifier: '',
tip_money: {},
verification_token: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/payments');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
accept_partial_authorization: false,
amount_money: {
amount: 0,
currency: ''
},
app_fee_money: {},
autocomplete: false,
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
cash_details: {
buyer_supplied_money: {},
change_back_money: {}
},
customer_id: '',
delay_duration: '',
external_details: {
source: '',
source_fee_money: {},
source_id: '',
type: ''
},
idempotency_key: '',
location_id: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
source_id: '',
statement_description_identifier: '',
tip_money: {},
verification_token: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/payments',
headers: {'content-type': 'application/json'},
data: {
accept_partial_authorization: false,
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
autocomplete: false,
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
cash_details: {buyer_supplied_money: {}, change_back_money: {}},
customer_id: '',
delay_duration: '',
external_details: {source: '', source_fee_money: {}, source_id: '', type: ''},
idempotency_key: '',
location_id: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
source_id: '',
statement_description_identifier: '',
tip_money: {},
verification_token: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/payments';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"accept_partial_authorization":false,"amount_money":{"amount":0,"currency":""},"app_fee_money":{},"autocomplete":false,"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"buyer_email_address":"","cash_details":{"buyer_supplied_money":{},"change_back_money":{}},"customer_id":"","delay_duration":"","external_details":{"source":"","source_fee_money":{},"source_id":"","type":""},"idempotency_key":"","location_id":"","note":"","order_id":"","reference_id":"","shipping_address":{},"source_id":"","statement_description_identifier":"","tip_money":{},"verification_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"accept_partial_authorization": @NO,
@"amount_money": @{ @"amount": @0, @"currency": @"" },
@"app_fee_money": @{ },
@"autocomplete": @NO,
@"billing_address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" },
@"buyer_email_address": @"",
@"cash_details": @{ @"buyer_supplied_money": @{ }, @"change_back_money": @{ } },
@"customer_id": @"",
@"delay_duration": @"",
@"external_details": @{ @"source": @"", @"source_fee_money": @{ }, @"source_id": @"", @"type": @"" },
@"idempotency_key": @"",
@"location_id": @"",
@"note": @"",
@"order_id": @"",
@"reference_id": @"",
@"shipping_address": @{ },
@"source_id": @"",
@"statement_description_identifier": @"",
@"tip_money": @{ },
@"verification_token": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/payments"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/payments" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accept_partial_authorization' => null,
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'autocomplete' => null,
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'cash_details' => [
'buyer_supplied_money' => [
],
'change_back_money' => [
]
],
'customer_id' => '',
'delay_duration' => '',
'external_details' => [
'source' => '',
'source_fee_money' => [
],
'source_id' => '',
'type' => ''
],
'idempotency_key' => '',
'location_id' => '',
'note' => '',
'order_id' => '',
'reference_id' => '',
'shipping_address' => [
],
'source_id' => '',
'statement_description_identifier' => '',
'tip_money' => [
],
'verification_token' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/payments', [
'body' => '{
"accept_partial_authorization": false,
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"autocomplete": false,
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"customer_id": "",
"delay_duration": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"source_id": "",
"statement_description_identifier": "",
"tip_money": {},
"verification_token": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/payments');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'accept_partial_authorization' => null,
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'autocomplete' => null,
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'cash_details' => [
'buyer_supplied_money' => [
],
'change_back_money' => [
]
],
'customer_id' => '',
'delay_duration' => '',
'external_details' => [
'source' => '',
'source_fee_money' => [
],
'source_id' => '',
'type' => ''
],
'idempotency_key' => '',
'location_id' => '',
'note' => '',
'order_id' => '',
'reference_id' => '',
'shipping_address' => [
],
'source_id' => '',
'statement_description_identifier' => '',
'tip_money' => [
],
'verification_token' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'accept_partial_authorization' => null,
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'autocomplete' => null,
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'cash_details' => [
'buyer_supplied_money' => [
],
'change_back_money' => [
]
],
'customer_id' => '',
'delay_duration' => '',
'external_details' => [
'source' => '',
'source_fee_money' => [
],
'source_id' => '',
'type' => ''
],
'idempotency_key' => '',
'location_id' => '',
'note' => '',
'order_id' => '',
'reference_id' => '',
'shipping_address' => [
],
'source_id' => '',
'statement_description_identifier' => '',
'tip_money' => [
],
'verification_token' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/payments');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/payments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"accept_partial_authorization": false,
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"autocomplete": false,
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"customer_id": "",
"delay_duration": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"source_id": "",
"statement_description_identifier": "",
"tip_money": {},
"verification_token": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/payments' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"accept_partial_authorization": false,
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"autocomplete": false,
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"customer_id": "",
"delay_duration": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"source_id": "",
"statement_description_identifier": "",
"tip_money": {},
"verification_token": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/payments", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/payments"
payload = {
"accept_partial_authorization": False,
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"autocomplete": False,
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"customer_id": "",
"delay_duration": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"source_id": "",
"statement_description_identifier": "",
"tip_money": {},
"verification_token": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/payments"
payload <- "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/payments') do |req|
req.body = "{\n \"accept_partial_authorization\": false,\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"autocomplete\": false,\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"customer_id\": \"\",\n \"delay_duration\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"source_id\": \"\",\n \"statement_description_identifier\": \"\",\n \"tip_money\": {},\n \"verification_token\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/payments";
let payload = json!({
"accept_partial_authorization": false,
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"app_fee_money": json!({}),
"autocomplete": false,
"billing_address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"buyer_email_address": "",
"cash_details": json!({
"buyer_supplied_money": json!({}),
"change_back_money": json!({})
}),
"customer_id": "",
"delay_duration": "",
"external_details": json!({
"source": "",
"source_fee_money": json!({}),
"source_id": "",
"type": ""
}),
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": json!({}),
"source_id": "",
"statement_description_identifier": "",
"tip_money": json!({}),
"verification_token": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/payments \
--header 'content-type: application/json' \
--data '{
"accept_partial_authorization": false,
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"autocomplete": false,
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"customer_id": "",
"delay_duration": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"source_id": "",
"statement_description_identifier": "",
"tip_money": {},
"verification_token": ""
}'
echo '{
"accept_partial_authorization": false,
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"autocomplete": false,
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"customer_id": "",
"delay_duration": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"source_id": "",
"statement_description_identifier": "",
"tip_money": {},
"verification_token": ""
}' | \
http POST {{baseUrl}}/v2/payments \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "accept_partial_authorization": false,\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_fee_money": {},\n "autocomplete": false,\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "buyer_email_address": "",\n "cash_details": {\n "buyer_supplied_money": {},\n "change_back_money": {}\n },\n "customer_id": "",\n "delay_duration": "",\n "external_details": {\n "source": "",\n "source_fee_money": {},\n "source_id": "",\n "type": ""\n },\n "idempotency_key": "",\n "location_id": "",\n "note": "",\n "order_id": "",\n "reference_id": "",\n "shipping_address": {},\n "source_id": "",\n "statement_description_identifier": "",\n "tip_money": {},\n "verification_token": ""\n}' \
--output-document \
- {{baseUrl}}/v2/payments
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"accept_partial_authorization": false,
"amount_money": [
"amount": 0,
"currency": ""
],
"app_fee_money": [],
"autocomplete": false,
"billing_address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"buyer_email_address": "",
"cash_details": [
"buyer_supplied_money": [],
"change_back_money": []
],
"customer_id": "",
"delay_duration": "",
"external_details": [
"source": "",
"source_fee_money": [],
"source_id": "",
"type": ""
],
"idempotency_key": "",
"location_id": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": [],
"source_id": "",
"statement_description_identifier": "",
"tip_money": [],
"verification_token": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/payments")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"payment": {
"amount_money": {
"amount": 200,
"currency": "USD"
},
"app_fee_money": {
"amount": 10,
"currency": "USD"
},
"approved_money": {
"amount": 200,
"currency": "USD"
},
"card_details": {
"auth_result_code": "nsAyY2",
"avs_status": "AVS_ACCEPTED",
"card": {
"bin": "411111",
"card_brand": "VISA",
"card_type": "DEBIT",
"exp_month": 7,
"exp_year": 2026,
"fingerprint": "sq-1-TpmjbNBMFdibiIjpQI5LiRgNUBC7u1689i0TgHjnlyHEWYB7tnn-K4QbW4ttvtaqXw",
"last_4": "1111",
"prepaid_type": "PREPAID"
},
"card_payment_timeline": {
"authorized_at": "2019-07-10T13:23:49.234Z",
"captured_at": "2019-07-10T13:23:49.446Z"
},
"cvv_status": "CVV_ACCEPTED",
"entry_method": "ON_FILE",
"statement_description": "SQ *MY MERCHANT",
"status": "CAPTURED"
},
"created_at": "2019-07-10T13:23:49.154Z",
"customer_id": "RDX9Z4XTIZR7MRZJUXNY9HUK6I",
"id": "GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
"location_id": "XTI0H92143A39",
"note": "Brief description",
"order_id": "m2Hr8Hk8A3CTyQQ1k4ynExg92tO3",
"receipt_number": "GQTF",
"receipt_url": "https://squareup.com/receipt/preview/GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
"reference_id": "123456",
"source_type": "CARD",
"status": "COMPLETED",
"total_money": {
"amount": 200,
"currency": "USD"
},
"updated_at": "2019-07-10T13:23:49.446Z",
"version_token": "H8Vnk5Z11SKcueuRti79jGpszSEsSVdhKRrSKCOzILG6o"
}
}
GET
GetPayment
{{baseUrl}}/v2/payments/:payment_id
QUERY PARAMS
payment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/payments/:payment_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/payments/:payment_id")
require "http/client"
url = "{{baseUrl}}/v2/payments/:payment_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/payments/:payment_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/payments/:payment_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/payments/:payment_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/payments/:payment_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/payments/:payment_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/payments/:payment_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/payments/:payment_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/payments/:payment_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/payments/:payment_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/payments/:payment_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/payments/:payment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/payments/:payment_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/payments/:payment_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/payments/:payment_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/payments/:payment_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/payments/:payment_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/payments/:payment_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/payments/:payment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/payments/:payment_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/payments/:payment_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/payments/:payment_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/payments/:payment_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/payments/:payment_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/payments/:payment_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/payments/:payment_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/payments/:payment_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/payments/:payment_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/payments/:payment_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/payments/:payment_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/payments/:payment_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/payments/:payment_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/payments/:payment_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/payments/:payment_id
http GET {{baseUrl}}/v2/payments/:payment_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/payments/:payment_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/payments/:payment_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"payment": {
"amount_money": {
"amount": 200,
"currency": "USD"
},
"app_fee_money": {
"amount": 10,
"currency": "USD"
},
"approved_money": {
"amount": 200,
"currency": "USD"
},
"card_details": {
"auth_result_code": "nsAyY2",
"avs_status": "AVS_ACCEPTED",
"card": {
"bin": "411111",
"card_brand": "VISA",
"card_type": "DEBIT",
"exp_month": 7,
"exp_year": 2026,
"fingerprint": "sq-1-TpmjbNBMFdibiIjpQI5LiRgNUBC7u1689i0TgHjnlyHEWYB7tnn-K4QbW4ttvtaqXw",
"last_4": "1111",
"prepaid_type": "PREPAID"
},
"card_payment_timeline": {
"authorized_at": "2019-07-10T13:23:49.234Z",
"captured_at": "2019-07-10T13:23:49.446Z"
},
"cvv_status": "CVV_ACCEPTED",
"entry_method": "ON_FILE",
"statement_description": "SQ *MY MERCHANT",
"status": "CAPTURED"
},
"created_at": "2019-07-10T13:23:49.154Z",
"customer_id": "RDX9Z4XTIZR7MRZJUXNY9HUK6I",
"id": "GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
"location_id": "XTI0H92143A39",
"note": "Brief description",
"order_id": "m2Hr8Hk8A3CTyQQ1k4ynExg92tO3",
"processing_fee": [
{
"amount_money": {
"amount": 36,
"currency": "USD"
},
"effective_at": "2019-07-10T15:23:49.000Z",
"type": "INITIAL"
}
],
"receipt_number": "GQTF",
"receipt_url": "https://squareup.com/receipt/preview/GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
"reference_id": "123456",
"source_type": "CARD",
"status": "COMPLETED",
"total_money": {
"amount": 200,
"currency": "USD"
},
"updated_at": "2019-07-10T13:23:49.446Z",
"version_token": "hj8JqHWu9R1Kkfu63UuIUmYc7zm6YFOt92g8d2fb9fz6o"
}
}
GET
ListPayments (GET)
{{baseUrl}}/v2/payments
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/payments");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/payments")
require "http/client"
url = "{{baseUrl}}/v2/payments"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/payments"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/payments");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/payments"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/payments HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/payments")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/payments"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/payments")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/payments")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/payments');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/payments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/payments';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/payments',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/payments")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/payments',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/payments'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/payments');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/payments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/payments';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/payments"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/payments" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/payments');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/payments');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/payments');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/payments' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/payments' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/payments")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/payments"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/payments"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/payments') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/payments";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/payments
http GET {{baseUrl}}/v2/payments
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/payments
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/payments")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "2TTnuq0yRYDdBRSFF2XuFkgO1Bclt4ZHNI7YrFNeyZ6rL1WZXkdnLn10H8fBIwFKdKW1Af6ifRa",
"payments": [
{
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"approved_money": {
"amount": 1000,
"currency": "USD"
},
"capabilities": [
"EDIT_AMOUNT_UP",
"EDIT_AMOUNT_DOWN",
"EDIT_TIP_AMOUNT_UP",
"EDIT_TIP_AMOUNT_DOWN"
],
"card_details": {
"auth_result_code": "NQbV3A",
"avs_status": "AVS_ACCEPTED",
"card": {
"card_brand": "VISA",
"exp_month": 2,
"exp_year": 2022,
"fingerprint": "sq-1-lHpUJIUyqOPQmH89b6GuQEljmc-mZmu4kSTaMlkLDkJI7NVjAl4Zirn2sk3OeyVKVA",
"last_4": "1111"
},
"card_payment_timeline": {
"authorized_at": "2019-07-09T14:36:13.798Z"
},
"cvv_status": "CVV_ACCEPTED",
"entry_method": "KEYED",
"status": "AUTHORIZED"
},
"created_at": "2019-07-09T14:36:13.745Z",
"id": "ifrBnAil7rRfDtd27cdf9g9WO8paB",
"location_id": "QLIJX16Q3UZ0A",
"order_id": "MvfIilKnIYKBium4rauH67wFzRxv",
"source_type": "CARD",
"status": "APPROVED",
"total_money": {
"amount": 1000,
"currency": "USD"
},
"updated_at": "2019-07-09T14:36:13.883Z",
"version_token": "v6orqdHcW2TwuzCQRdF6a4ktbG8T8nbDcBx8eyrkoZl6o"
},
{
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"approved_money": {
"amount": 1000,
"currency": "USD"
},
"card_details": {
"auth_result_code": "vPIr0K",
"avs_status": "AVS_ACCEPTED",
"card": {
"card_brand": "VISA",
"exp_month": 7,
"exp_year": 2026,
"fingerprint": "sq-1-TpmjbNBMFdibiIjpQI5LiRgNUBC7u1689i0TgHjnlyHEWYB7tnn-K4QbW4ttvtaqXw",
"last_4": "2796"
},
"card_payment_timeline": {
"authorized_at": "2019-07-08T01:00:51.617Z",
"captured_at": "2019-07-08T01:13:58.508Z"
},
"cvv_status": "CVV_ACCEPTED",
"entry_method": "ON_FILE",
"status": "CAPTURED"
},
"created_at": "2019-07-08T01:00:51.607Z",
"customer_id": "RDX9Z4XTIZR7MRZJUXNY9HUK6I",
"id": "GQTFp1ZlXdpoW4o6eGiZhbjosiDFf",
"location_id": "XTI0H92143A39",
"order_id": "m2Hr8Hk8A3CTyQQ1k4ynExg92tO3",
"processing_fee": [
{
"amount_money": {
"amount": 59,
"currency": "USD"
},
"effective_at": "2019-07-08T03:00:53.000Z",
"type": "INITIAL"
}
],
"source_type": "CARD",
"status": "COMPLETED",
"total_money": {
"amount": 1000,
"currency": "USD"
},
"updated_at": "2019-07-08T01:13:58.508Z",
"version_token": "pE0wanQBErcnO4ubL49pHCV1yAs4BUScWXb8fVvkRqa6o"
}
]
}
PUT
UpdatePayment
{{baseUrl}}/v2/payments/:payment_id
QUERY PARAMS
payment_id
BODY json
{
"idempotency_key": "",
"payment": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"approved_money": {},
"bank_account_details": {
"account_ownership_type": "",
"ach_details": {
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
},
"bank_name": "",
"country": "",
"errors": [
{
"category": "",
"code": "",
"detail": "",
"field": ""
}
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"capabilities": [],
"card_details": {
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"card_payment_timeline": {
"authorized_at": "",
"captured_at": "",
"voided_at": ""
},
"cvv_status": "",
"device_details": {
"device_id": "",
"device_installation_id": "",
"device_name": ""
},
"entry_method": "",
"errors": [
{}
],
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
},
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
{
"amount_money": {},
"effective_at": "",
"type": ""
}
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": {},
"risk_evaluation": {
"created_at": "",
"risk_level": ""
},
"shipping_address": {},
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": {},
"total_money": {},
"updated_at": "",
"version_token": "",
"wallet_details": {
"status": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/payments/:payment_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/payments/:payment_id" {:content-type :json
:form-params {:idempotency_key ""
:payment {:amount_money {:amount 0
:currency ""}
:app_fee_money {}
:approved_money {}
:bank_account_details {:account_ownership_type ""
:ach_details {:account_number_suffix ""
:account_type ""
:routing_number ""}
:bank_name ""
:country ""
:errors [{:category ""
:code ""
:detail ""
:field ""}]
:fingerprint ""
:statement_description ""
:transfer_type ""}
:billing_address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:buyer_email_address ""
:capabilities []
:card_details {:application_cryptogram ""
:application_identifier ""
:application_name ""
:auth_result_code ""
:avs_status ""
:card {:billing_address {}
:bin ""
:card_brand ""
:card_type ""
:cardholder_name ""
:customer_id ""
:enabled false
:exp_month 0
:exp_year 0
:fingerprint ""
:id ""
:last_4 ""
:prepaid_type ""
:reference_id ""
:version 0}
:card_payment_timeline {:authorized_at ""
:captured_at ""
:voided_at ""}
:cvv_status ""
:device_details {:device_id ""
:device_installation_id ""
:device_name ""}
:entry_method ""
:errors [{}]
:refund_requires_card_presence false
:statement_description ""
:status ""
:verification_method ""
:verification_results ""}
:cash_details {:buyer_supplied_money {}
:change_back_money {}}
:created_at ""
:customer_id ""
:delay_action ""
:delay_duration ""
:delayed_until ""
:employee_id ""
:external_details {:source ""
:source_fee_money {}
:source_id ""
:type ""}
:id ""
:location_id ""
:note ""
:order_id ""
:processing_fee [{:amount_money {}
:effective_at ""
:type ""}]
:receipt_number ""
:receipt_url ""
:reference_id ""
:refund_ids []
:refunded_money {}
:risk_evaluation {:created_at ""
:risk_level ""}
:shipping_address {}
:source_type ""
:statement_description_identifier ""
:status ""
:tip_money {}
:total_money {}
:updated_at ""
:version_token ""
:wallet_details {:status ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/payments/:payment_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/payments/:payment_id"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/payments/:payment_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/payments/:payment_id"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/payments/:payment_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 3256
{
"idempotency_key": "",
"payment": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"approved_money": {},
"bank_account_details": {
"account_ownership_type": "",
"ach_details": {
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
},
"bank_name": "",
"country": "",
"errors": [
{
"category": "",
"code": "",
"detail": "",
"field": ""
}
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"capabilities": [],
"card_details": {
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"card_payment_timeline": {
"authorized_at": "",
"captured_at": "",
"voided_at": ""
},
"cvv_status": "",
"device_details": {
"device_id": "",
"device_installation_id": "",
"device_name": ""
},
"entry_method": "",
"errors": [
{}
],
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
},
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
{
"amount_money": {},
"effective_at": "",
"type": ""
}
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": {},
"risk_evaluation": {
"created_at": "",
"risk_level": ""
},
"shipping_address": {},
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": {},
"total_money": {},
"updated_at": "",
"version_token": "",
"wallet_details": {
"status": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/payments/:payment_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/payments/:payment_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/payments/:payment_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/payments/:payment_id")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
payment: {
amount_money: {
amount: 0,
currency: ''
},
app_fee_money: {},
approved_money: {},
bank_account_details: {
account_ownership_type: '',
ach_details: {
account_number_suffix: '',
account_type: '',
routing_number: ''
},
bank_name: '',
country: '',
errors: [
{
category: '',
code: '',
detail: '',
field: ''
}
],
fingerprint: '',
statement_description: '',
transfer_type: ''
},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
capabilities: [],
card_details: {
application_cryptogram: '',
application_identifier: '',
application_name: '',
auth_result_code: '',
avs_status: '',
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
card_payment_timeline: {
authorized_at: '',
captured_at: '',
voided_at: ''
},
cvv_status: '',
device_details: {
device_id: '',
device_installation_id: '',
device_name: ''
},
entry_method: '',
errors: [
{}
],
refund_requires_card_presence: false,
statement_description: '',
status: '',
verification_method: '',
verification_results: ''
},
cash_details: {
buyer_supplied_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
delay_action: '',
delay_duration: '',
delayed_until: '',
employee_id: '',
external_details: {
source: '',
source_fee_money: {},
source_id: '',
type: ''
},
id: '',
location_id: '',
note: '',
order_id: '',
processing_fee: [
{
amount_money: {},
effective_at: '',
type: ''
}
],
receipt_number: '',
receipt_url: '',
reference_id: '',
refund_ids: [],
refunded_money: {},
risk_evaluation: {
created_at: '',
risk_level: ''
},
shipping_address: {},
source_type: '',
statement_description_identifier: '',
status: '',
tip_money: {},
total_money: {},
updated_at: '',
version_token: '',
wallet_details: {
status: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/payments/:payment_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/payments/:payment_id',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
payment: {
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
approved_money: {},
bank_account_details: {
account_ownership_type: '',
ach_details: {account_number_suffix: '', account_type: '', routing_number: ''},
bank_name: '',
country: '',
errors: [{category: '', code: '', detail: '', field: ''}],
fingerprint: '',
statement_description: '',
transfer_type: ''
},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
capabilities: [],
card_details: {
application_cryptogram: '',
application_identifier: '',
application_name: '',
auth_result_code: '',
avs_status: '',
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
card_payment_timeline: {authorized_at: '', captured_at: '', voided_at: ''},
cvv_status: '',
device_details: {device_id: '', device_installation_id: '', device_name: ''},
entry_method: '',
errors: [{}],
refund_requires_card_presence: false,
statement_description: '',
status: '',
verification_method: '',
verification_results: ''
},
cash_details: {buyer_supplied_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
delay_action: '',
delay_duration: '',
delayed_until: '',
employee_id: '',
external_details: {source: '', source_fee_money: {}, source_id: '', type: ''},
id: '',
location_id: '',
note: '',
order_id: '',
processing_fee: [{amount_money: {}, effective_at: '', type: ''}],
receipt_number: '',
receipt_url: '',
reference_id: '',
refund_ids: [],
refunded_money: {},
risk_evaluation: {created_at: '', risk_level: ''},
shipping_address: {},
source_type: '',
statement_description_identifier: '',
status: '',
tip_money: {},
total_money: {},
updated_at: '',
version_token: '',
wallet_details: {status: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/payments/:payment_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","payment":{"amount_money":{"amount":0,"currency":""},"app_fee_money":{},"approved_money":{},"bank_account_details":{"account_ownership_type":"","ach_details":{"account_number_suffix":"","account_type":"","routing_number":""},"bank_name":"","country":"","errors":[{"category":"","code":"","detail":"","field":""}],"fingerprint":"","statement_description":"","transfer_type":""},"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"buyer_email_address":"","capabilities":[],"card_details":{"application_cryptogram":"","application_identifier":"","application_name":"","auth_result_code":"","avs_status":"","card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"card_payment_timeline":{"authorized_at":"","captured_at":"","voided_at":""},"cvv_status":"","device_details":{"device_id":"","device_installation_id":"","device_name":""},"entry_method":"","errors":[{}],"refund_requires_card_presence":false,"statement_description":"","status":"","verification_method":"","verification_results":""},"cash_details":{"buyer_supplied_money":{},"change_back_money":{}},"created_at":"","customer_id":"","delay_action":"","delay_duration":"","delayed_until":"","employee_id":"","external_details":{"source":"","source_fee_money":{},"source_id":"","type":""},"id":"","location_id":"","note":"","order_id":"","processing_fee":[{"amount_money":{},"effective_at":"","type":""}],"receipt_number":"","receipt_url":"","reference_id":"","refund_ids":[],"refunded_money":{},"risk_evaluation":{"created_at":"","risk_level":""},"shipping_address":{},"source_type":"","statement_description_identifier":"","status":"","tip_money":{},"total_money":{},"updated_at":"","version_token":"","wallet_details":{"status":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/payments/:payment_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "payment": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_fee_money": {},\n "approved_money": {},\n "bank_account_details": {\n "account_ownership_type": "",\n "ach_details": {\n "account_number_suffix": "",\n "account_type": "",\n "routing_number": ""\n },\n "bank_name": "",\n "country": "",\n "errors": [\n {\n "category": "",\n "code": "",\n "detail": "",\n "field": ""\n }\n ],\n "fingerprint": "",\n "statement_description": "",\n "transfer_type": ""\n },\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "buyer_email_address": "",\n "capabilities": [],\n "card_details": {\n "application_cryptogram": "",\n "application_identifier": "",\n "application_name": "",\n "auth_result_code": "",\n "avs_status": "",\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "card_payment_timeline": {\n "authorized_at": "",\n "captured_at": "",\n "voided_at": ""\n },\n "cvv_status": "",\n "device_details": {\n "device_id": "",\n "device_installation_id": "",\n "device_name": ""\n },\n "entry_method": "",\n "errors": [\n {}\n ],\n "refund_requires_card_presence": false,\n "statement_description": "",\n "status": "",\n "verification_method": "",\n "verification_results": ""\n },\n "cash_details": {\n "buyer_supplied_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "delay_action": "",\n "delay_duration": "",\n "delayed_until": "",\n "employee_id": "",\n "external_details": {\n "source": "",\n "source_fee_money": {},\n "source_id": "",\n "type": ""\n },\n "id": "",\n "location_id": "",\n "note": "",\n "order_id": "",\n "processing_fee": [\n {\n "amount_money": {},\n "effective_at": "",\n "type": ""\n }\n ],\n "receipt_number": "",\n "receipt_url": "",\n "reference_id": "",\n "refund_ids": [],\n "refunded_money": {},\n "risk_evaluation": {\n "created_at": "",\n "risk_level": ""\n },\n "shipping_address": {},\n "source_type": "",\n "statement_description_identifier": "",\n "status": "",\n "tip_money": {},\n "total_money": {},\n "updated_at": "",\n "version_token": "",\n "wallet_details": {\n "status": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/payments/:payment_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/payments/:payment_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
payment: {
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
approved_money: {},
bank_account_details: {
account_ownership_type: '',
ach_details: {account_number_suffix: '', account_type: '', routing_number: ''},
bank_name: '',
country: '',
errors: [{category: '', code: '', detail: '', field: ''}],
fingerprint: '',
statement_description: '',
transfer_type: ''
},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
capabilities: [],
card_details: {
application_cryptogram: '',
application_identifier: '',
application_name: '',
auth_result_code: '',
avs_status: '',
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
card_payment_timeline: {authorized_at: '', captured_at: '', voided_at: ''},
cvv_status: '',
device_details: {device_id: '', device_installation_id: '', device_name: ''},
entry_method: '',
errors: [{}],
refund_requires_card_presence: false,
statement_description: '',
status: '',
verification_method: '',
verification_results: ''
},
cash_details: {buyer_supplied_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
delay_action: '',
delay_duration: '',
delayed_until: '',
employee_id: '',
external_details: {source: '', source_fee_money: {}, source_id: '', type: ''},
id: '',
location_id: '',
note: '',
order_id: '',
processing_fee: [{amount_money: {}, effective_at: '', type: ''}],
receipt_number: '',
receipt_url: '',
reference_id: '',
refund_ids: [],
refunded_money: {},
risk_evaluation: {created_at: '', risk_level: ''},
shipping_address: {},
source_type: '',
statement_description_identifier: '',
status: '',
tip_money: {},
total_money: {},
updated_at: '',
version_token: '',
wallet_details: {status: ''}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/payments/:payment_id',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
payment: {
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
approved_money: {},
bank_account_details: {
account_ownership_type: '',
ach_details: {account_number_suffix: '', account_type: '', routing_number: ''},
bank_name: '',
country: '',
errors: [{category: '', code: '', detail: '', field: ''}],
fingerprint: '',
statement_description: '',
transfer_type: ''
},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
capabilities: [],
card_details: {
application_cryptogram: '',
application_identifier: '',
application_name: '',
auth_result_code: '',
avs_status: '',
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
card_payment_timeline: {authorized_at: '', captured_at: '', voided_at: ''},
cvv_status: '',
device_details: {device_id: '', device_installation_id: '', device_name: ''},
entry_method: '',
errors: [{}],
refund_requires_card_presence: false,
statement_description: '',
status: '',
verification_method: '',
verification_results: ''
},
cash_details: {buyer_supplied_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
delay_action: '',
delay_duration: '',
delayed_until: '',
employee_id: '',
external_details: {source: '', source_fee_money: {}, source_id: '', type: ''},
id: '',
location_id: '',
note: '',
order_id: '',
processing_fee: [{amount_money: {}, effective_at: '', type: ''}],
receipt_number: '',
receipt_url: '',
reference_id: '',
refund_ids: [],
refunded_money: {},
risk_evaluation: {created_at: '', risk_level: ''},
shipping_address: {},
source_type: '',
statement_description_identifier: '',
status: '',
tip_money: {},
total_money: {},
updated_at: '',
version_token: '',
wallet_details: {status: ''}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/payments/:payment_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
payment: {
amount_money: {
amount: 0,
currency: ''
},
app_fee_money: {},
approved_money: {},
bank_account_details: {
account_ownership_type: '',
ach_details: {
account_number_suffix: '',
account_type: '',
routing_number: ''
},
bank_name: '',
country: '',
errors: [
{
category: '',
code: '',
detail: '',
field: ''
}
],
fingerprint: '',
statement_description: '',
transfer_type: ''
},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
capabilities: [],
card_details: {
application_cryptogram: '',
application_identifier: '',
application_name: '',
auth_result_code: '',
avs_status: '',
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
card_payment_timeline: {
authorized_at: '',
captured_at: '',
voided_at: ''
},
cvv_status: '',
device_details: {
device_id: '',
device_installation_id: '',
device_name: ''
},
entry_method: '',
errors: [
{}
],
refund_requires_card_presence: false,
statement_description: '',
status: '',
verification_method: '',
verification_results: ''
},
cash_details: {
buyer_supplied_money: {},
change_back_money: {}
},
created_at: '',
customer_id: '',
delay_action: '',
delay_duration: '',
delayed_until: '',
employee_id: '',
external_details: {
source: '',
source_fee_money: {},
source_id: '',
type: ''
},
id: '',
location_id: '',
note: '',
order_id: '',
processing_fee: [
{
amount_money: {},
effective_at: '',
type: ''
}
],
receipt_number: '',
receipt_url: '',
reference_id: '',
refund_ids: [],
refunded_money: {},
risk_evaluation: {
created_at: '',
risk_level: ''
},
shipping_address: {},
source_type: '',
statement_description_identifier: '',
status: '',
tip_money: {},
total_money: {},
updated_at: '',
version_token: '',
wallet_details: {
status: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/payments/:payment_id',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
payment: {
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
approved_money: {},
bank_account_details: {
account_ownership_type: '',
ach_details: {account_number_suffix: '', account_type: '', routing_number: ''},
bank_name: '',
country: '',
errors: [{category: '', code: '', detail: '', field: ''}],
fingerprint: '',
statement_description: '',
transfer_type: ''
},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
capabilities: [],
card_details: {
application_cryptogram: '',
application_identifier: '',
application_name: '',
auth_result_code: '',
avs_status: '',
card: {
billing_address: {},
bin: '',
card_brand: '',
card_type: '',
cardholder_name: '',
customer_id: '',
enabled: false,
exp_month: 0,
exp_year: 0,
fingerprint: '',
id: '',
last_4: '',
prepaid_type: '',
reference_id: '',
version: 0
},
card_payment_timeline: {authorized_at: '', captured_at: '', voided_at: ''},
cvv_status: '',
device_details: {device_id: '', device_installation_id: '', device_name: ''},
entry_method: '',
errors: [{}],
refund_requires_card_presence: false,
statement_description: '',
status: '',
verification_method: '',
verification_results: ''
},
cash_details: {buyer_supplied_money: {}, change_back_money: {}},
created_at: '',
customer_id: '',
delay_action: '',
delay_duration: '',
delayed_until: '',
employee_id: '',
external_details: {source: '', source_fee_money: {}, source_id: '', type: ''},
id: '',
location_id: '',
note: '',
order_id: '',
processing_fee: [{amount_money: {}, effective_at: '', type: ''}],
receipt_number: '',
receipt_url: '',
reference_id: '',
refund_ids: [],
refunded_money: {},
risk_evaluation: {created_at: '', risk_level: ''},
shipping_address: {},
source_type: '',
statement_description_identifier: '',
status: '',
tip_money: {},
total_money: {},
updated_at: '',
version_token: '',
wallet_details: {status: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/payments/:payment_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","payment":{"amount_money":{"amount":0,"currency":""},"app_fee_money":{},"approved_money":{},"bank_account_details":{"account_ownership_type":"","ach_details":{"account_number_suffix":"","account_type":"","routing_number":""},"bank_name":"","country":"","errors":[{"category":"","code":"","detail":"","field":""}],"fingerprint":"","statement_description":"","transfer_type":""},"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"buyer_email_address":"","capabilities":[],"card_details":{"application_cryptogram":"","application_identifier":"","application_name":"","auth_result_code":"","avs_status":"","card":{"billing_address":{},"bin":"","card_brand":"","card_type":"","cardholder_name":"","customer_id":"","enabled":false,"exp_month":0,"exp_year":0,"fingerprint":"","id":"","last_4":"","prepaid_type":"","reference_id":"","version":0},"card_payment_timeline":{"authorized_at":"","captured_at":"","voided_at":""},"cvv_status":"","device_details":{"device_id":"","device_installation_id":"","device_name":""},"entry_method":"","errors":[{}],"refund_requires_card_presence":false,"statement_description":"","status":"","verification_method":"","verification_results":""},"cash_details":{"buyer_supplied_money":{},"change_back_money":{}},"created_at":"","customer_id":"","delay_action":"","delay_duration":"","delayed_until":"","employee_id":"","external_details":{"source":"","source_fee_money":{},"source_id":"","type":""},"id":"","location_id":"","note":"","order_id":"","processing_fee":[{"amount_money":{},"effective_at":"","type":""}],"receipt_number":"","receipt_url":"","reference_id":"","refund_ids":[],"refunded_money":{},"risk_evaluation":{"created_at":"","risk_level":""},"shipping_address":{},"source_type":"","statement_description_identifier":"","status":"","tip_money":{},"total_money":{},"updated_at":"","version_token":"","wallet_details":{"status":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"payment": @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"app_fee_money": @{ }, @"approved_money": @{ }, @"bank_account_details": @{ @"account_ownership_type": @"", @"ach_details": @{ @"account_number_suffix": @"", @"account_type": @"", @"routing_number": @"" }, @"bank_name": @"", @"country": @"", @"errors": @[ @{ @"category": @"", @"code": @"", @"detail": @"", @"field": @"" } ], @"fingerprint": @"", @"statement_description": @"", @"transfer_type": @"" }, @"billing_address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" }, @"buyer_email_address": @"", @"capabilities": @[ ], @"card_details": @{ @"application_cryptogram": @"", @"application_identifier": @"", @"application_name": @"", @"auth_result_code": @"", @"avs_status": @"", @"card": @{ @"billing_address": @{ }, @"bin": @"", @"card_brand": @"", @"card_type": @"", @"cardholder_name": @"", @"customer_id": @"", @"enabled": @NO, @"exp_month": @0, @"exp_year": @0, @"fingerprint": @"", @"id": @"", @"last_4": @"", @"prepaid_type": @"", @"reference_id": @"", @"version": @0 }, @"card_payment_timeline": @{ @"authorized_at": @"", @"captured_at": @"", @"voided_at": @"" }, @"cvv_status": @"", @"device_details": @{ @"device_id": @"", @"device_installation_id": @"", @"device_name": @"" }, @"entry_method": @"", @"errors": @[ @{ } ], @"refund_requires_card_presence": @NO, @"statement_description": @"", @"status": @"", @"verification_method": @"", @"verification_results": @"" }, @"cash_details": @{ @"buyer_supplied_money": @{ }, @"change_back_money": @{ } }, @"created_at": @"", @"customer_id": @"", @"delay_action": @"", @"delay_duration": @"", @"delayed_until": @"", @"employee_id": @"", @"external_details": @{ @"source": @"", @"source_fee_money": @{ }, @"source_id": @"", @"type": @"" }, @"id": @"", @"location_id": @"", @"note": @"", @"order_id": @"", @"processing_fee": @[ @{ @"amount_money": @{ }, @"effective_at": @"", @"type": @"" } ], @"receipt_number": @"", @"receipt_url": @"", @"reference_id": @"", @"refund_ids": @[ ], @"refunded_money": @{ }, @"risk_evaluation": @{ @"created_at": @"", @"risk_level": @"" }, @"shipping_address": @{ }, @"source_type": @"", @"statement_description_identifier": @"", @"status": @"", @"tip_money": @{ }, @"total_money": @{ }, @"updated_at": @"", @"version_token": @"", @"wallet_details": @{ @"status": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/payments/:payment_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/payments/:payment_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/payments/:payment_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'payment' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'approved_money' => [
],
'bank_account_details' => [
'account_ownership_type' => '',
'ach_details' => [
'account_number_suffix' => '',
'account_type' => '',
'routing_number' => ''
],
'bank_name' => '',
'country' => '',
'errors' => [
[
'category' => '',
'code' => '',
'detail' => '',
'field' => ''
]
],
'fingerprint' => '',
'statement_description' => '',
'transfer_type' => ''
],
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'capabilities' => [
],
'card_details' => [
'application_cryptogram' => '',
'application_identifier' => '',
'application_name' => '',
'auth_result_code' => '',
'avs_status' => '',
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'card_payment_timeline' => [
'authorized_at' => '',
'captured_at' => '',
'voided_at' => ''
],
'cvv_status' => '',
'device_details' => [
'device_id' => '',
'device_installation_id' => '',
'device_name' => ''
],
'entry_method' => '',
'errors' => [
[
]
],
'refund_requires_card_presence' => null,
'statement_description' => '',
'status' => '',
'verification_method' => '',
'verification_results' => ''
],
'cash_details' => [
'buyer_supplied_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'delay_action' => '',
'delay_duration' => '',
'delayed_until' => '',
'employee_id' => '',
'external_details' => [
'source' => '',
'source_fee_money' => [
],
'source_id' => '',
'type' => ''
],
'id' => '',
'location_id' => '',
'note' => '',
'order_id' => '',
'processing_fee' => [
[
'amount_money' => [
],
'effective_at' => '',
'type' => ''
]
],
'receipt_number' => '',
'receipt_url' => '',
'reference_id' => '',
'refund_ids' => [
],
'refunded_money' => [
],
'risk_evaluation' => [
'created_at' => '',
'risk_level' => ''
],
'shipping_address' => [
],
'source_type' => '',
'statement_description_identifier' => '',
'status' => '',
'tip_money' => [
],
'total_money' => [
],
'updated_at' => '',
'version_token' => '',
'wallet_details' => [
'status' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/payments/:payment_id', [
'body' => '{
"idempotency_key": "",
"payment": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"approved_money": {},
"bank_account_details": {
"account_ownership_type": "",
"ach_details": {
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
},
"bank_name": "",
"country": "",
"errors": [
{
"category": "",
"code": "",
"detail": "",
"field": ""
}
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"capabilities": [],
"card_details": {
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"card_payment_timeline": {
"authorized_at": "",
"captured_at": "",
"voided_at": ""
},
"cvv_status": "",
"device_details": {
"device_id": "",
"device_installation_id": "",
"device_name": ""
},
"entry_method": "",
"errors": [
{}
],
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
},
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
{
"amount_money": {},
"effective_at": "",
"type": ""
}
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": {},
"risk_evaluation": {
"created_at": "",
"risk_level": ""
},
"shipping_address": {},
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": {},
"total_money": {},
"updated_at": "",
"version_token": "",
"wallet_details": {
"status": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/payments/:payment_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'payment' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'approved_money' => [
],
'bank_account_details' => [
'account_ownership_type' => '',
'ach_details' => [
'account_number_suffix' => '',
'account_type' => '',
'routing_number' => ''
],
'bank_name' => '',
'country' => '',
'errors' => [
[
'category' => '',
'code' => '',
'detail' => '',
'field' => ''
]
],
'fingerprint' => '',
'statement_description' => '',
'transfer_type' => ''
],
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'capabilities' => [
],
'card_details' => [
'application_cryptogram' => '',
'application_identifier' => '',
'application_name' => '',
'auth_result_code' => '',
'avs_status' => '',
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'card_payment_timeline' => [
'authorized_at' => '',
'captured_at' => '',
'voided_at' => ''
],
'cvv_status' => '',
'device_details' => [
'device_id' => '',
'device_installation_id' => '',
'device_name' => ''
],
'entry_method' => '',
'errors' => [
[
]
],
'refund_requires_card_presence' => null,
'statement_description' => '',
'status' => '',
'verification_method' => '',
'verification_results' => ''
],
'cash_details' => [
'buyer_supplied_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'delay_action' => '',
'delay_duration' => '',
'delayed_until' => '',
'employee_id' => '',
'external_details' => [
'source' => '',
'source_fee_money' => [
],
'source_id' => '',
'type' => ''
],
'id' => '',
'location_id' => '',
'note' => '',
'order_id' => '',
'processing_fee' => [
[
'amount_money' => [
],
'effective_at' => '',
'type' => ''
]
],
'receipt_number' => '',
'receipt_url' => '',
'reference_id' => '',
'refund_ids' => [
],
'refunded_money' => [
],
'risk_evaluation' => [
'created_at' => '',
'risk_level' => ''
],
'shipping_address' => [
],
'source_type' => '',
'statement_description_identifier' => '',
'status' => '',
'tip_money' => [
],
'total_money' => [
],
'updated_at' => '',
'version_token' => '',
'wallet_details' => [
'status' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'payment' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'approved_money' => [
],
'bank_account_details' => [
'account_ownership_type' => '',
'ach_details' => [
'account_number_suffix' => '',
'account_type' => '',
'routing_number' => ''
],
'bank_name' => '',
'country' => '',
'errors' => [
[
'category' => '',
'code' => '',
'detail' => '',
'field' => ''
]
],
'fingerprint' => '',
'statement_description' => '',
'transfer_type' => ''
],
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'capabilities' => [
],
'card_details' => [
'application_cryptogram' => '',
'application_identifier' => '',
'application_name' => '',
'auth_result_code' => '',
'avs_status' => '',
'card' => [
'billing_address' => [
],
'bin' => '',
'card_brand' => '',
'card_type' => '',
'cardholder_name' => '',
'customer_id' => '',
'enabled' => null,
'exp_month' => 0,
'exp_year' => 0,
'fingerprint' => '',
'id' => '',
'last_4' => '',
'prepaid_type' => '',
'reference_id' => '',
'version' => 0
],
'card_payment_timeline' => [
'authorized_at' => '',
'captured_at' => '',
'voided_at' => ''
],
'cvv_status' => '',
'device_details' => [
'device_id' => '',
'device_installation_id' => '',
'device_name' => ''
],
'entry_method' => '',
'errors' => [
[
]
],
'refund_requires_card_presence' => null,
'statement_description' => '',
'status' => '',
'verification_method' => '',
'verification_results' => ''
],
'cash_details' => [
'buyer_supplied_money' => [
],
'change_back_money' => [
]
],
'created_at' => '',
'customer_id' => '',
'delay_action' => '',
'delay_duration' => '',
'delayed_until' => '',
'employee_id' => '',
'external_details' => [
'source' => '',
'source_fee_money' => [
],
'source_id' => '',
'type' => ''
],
'id' => '',
'location_id' => '',
'note' => '',
'order_id' => '',
'processing_fee' => [
[
'amount_money' => [
],
'effective_at' => '',
'type' => ''
]
],
'receipt_number' => '',
'receipt_url' => '',
'reference_id' => '',
'refund_ids' => [
],
'refunded_money' => [
],
'risk_evaluation' => [
'created_at' => '',
'risk_level' => ''
],
'shipping_address' => [
],
'source_type' => '',
'statement_description_identifier' => '',
'status' => '',
'tip_money' => [
],
'total_money' => [
],
'updated_at' => '',
'version_token' => '',
'wallet_details' => [
'status' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/payments/:payment_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/payments/:payment_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"payment": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"approved_money": {},
"bank_account_details": {
"account_ownership_type": "",
"ach_details": {
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
},
"bank_name": "",
"country": "",
"errors": [
{
"category": "",
"code": "",
"detail": "",
"field": ""
}
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"capabilities": [],
"card_details": {
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"card_payment_timeline": {
"authorized_at": "",
"captured_at": "",
"voided_at": ""
},
"cvv_status": "",
"device_details": {
"device_id": "",
"device_installation_id": "",
"device_name": ""
},
"entry_method": "",
"errors": [
{}
],
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
},
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
{
"amount_money": {},
"effective_at": "",
"type": ""
}
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": {},
"risk_evaluation": {
"created_at": "",
"risk_level": ""
},
"shipping_address": {},
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": {},
"total_money": {},
"updated_at": "",
"version_token": "",
"wallet_details": {
"status": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/payments/:payment_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"payment": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"approved_money": {},
"bank_account_details": {
"account_ownership_type": "",
"ach_details": {
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
},
"bank_name": "",
"country": "",
"errors": [
{
"category": "",
"code": "",
"detail": "",
"field": ""
}
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"capabilities": [],
"card_details": {
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"card_payment_timeline": {
"authorized_at": "",
"captured_at": "",
"voided_at": ""
},
"cvv_status": "",
"device_details": {
"device_id": "",
"device_installation_id": "",
"device_name": ""
},
"entry_method": "",
"errors": [
{}
],
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
},
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
{
"amount_money": {},
"effective_at": "",
"type": ""
}
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": {},
"risk_evaluation": {
"created_at": "",
"risk_level": ""
},
"shipping_address": {},
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": {},
"total_money": {},
"updated_at": "",
"version_token": "",
"wallet_details": {
"status": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/payments/:payment_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/payments/:payment_id"
payload = {
"idempotency_key": "",
"payment": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"approved_money": {},
"bank_account_details": {
"account_ownership_type": "",
"ach_details": {
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
},
"bank_name": "",
"country": "",
"errors": [
{
"category": "",
"code": "",
"detail": "",
"field": ""
}
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"capabilities": [],
"card_details": {
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": False,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"card_payment_timeline": {
"authorized_at": "",
"captured_at": "",
"voided_at": ""
},
"cvv_status": "",
"device_details": {
"device_id": "",
"device_installation_id": "",
"device_name": ""
},
"entry_method": "",
"errors": [{}],
"refund_requires_card_presence": False,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
},
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
{
"amount_money": {},
"effective_at": "",
"type": ""
}
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": {},
"risk_evaluation": {
"created_at": "",
"risk_level": ""
},
"shipping_address": {},
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": {},
"total_money": {},
"updated_at": "",
"version_token": "",
"wallet_details": { "status": "" }
}
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/payments/:payment_id"
payload <- "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/payments/:payment_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/payments/:payment_id') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"payment\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"approved_money\": {},\n \"bank_account_details\": {\n \"account_ownership_type\": \"\",\n \"ach_details\": {\n \"account_number_suffix\": \"\",\n \"account_type\": \"\",\n \"routing_number\": \"\"\n },\n \"bank_name\": \"\",\n \"country\": \"\",\n \"errors\": [\n {\n \"category\": \"\",\n \"code\": \"\",\n \"detail\": \"\",\n \"field\": \"\"\n }\n ],\n \"fingerprint\": \"\",\n \"statement_description\": \"\",\n \"transfer_type\": \"\"\n },\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"capabilities\": [],\n \"card_details\": {\n \"application_cryptogram\": \"\",\n \"application_identifier\": \"\",\n \"application_name\": \"\",\n \"auth_result_code\": \"\",\n \"avs_status\": \"\",\n \"card\": {\n \"billing_address\": {},\n \"bin\": \"\",\n \"card_brand\": \"\",\n \"card_type\": \"\",\n \"cardholder_name\": \"\",\n \"customer_id\": \"\",\n \"enabled\": false,\n \"exp_month\": 0,\n \"exp_year\": 0,\n \"fingerprint\": \"\",\n \"id\": \"\",\n \"last_4\": \"\",\n \"prepaid_type\": \"\",\n \"reference_id\": \"\",\n \"version\": 0\n },\n \"card_payment_timeline\": {\n \"authorized_at\": \"\",\n \"captured_at\": \"\",\n \"voided_at\": \"\"\n },\n \"cvv_status\": \"\",\n \"device_details\": {\n \"device_id\": \"\",\n \"device_installation_id\": \"\",\n \"device_name\": \"\"\n },\n \"entry_method\": \"\",\n \"errors\": [\n {}\n ],\n \"refund_requires_card_presence\": false,\n \"statement_description\": \"\",\n \"status\": \"\",\n \"verification_method\": \"\",\n \"verification_results\": \"\"\n },\n \"cash_details\": {\n \"buyer_supplied_money\": {},\n \"change_back_money\": {}\n },\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"delay_action\": \"\",\n \"delay_duration\": \"\",\n \"delayed_until\": \"\",\n \"employee_id\": \"\",\n \"external_details\": {\n \"source\": \"\",\n \"source_fee_money\": {},\n \"source_id\": \"\",\n \"type\": \"\"\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"processing_fee\": [\n {\n \"amount_money\": {},\n \"effective_at\": \"\",\n \"type\": \"\"\n }\n ],\n \"receipt_number\": \"\",\n \"receipt_url\": \"\",\n \"reference_id\": \"\",\n \"refund_ids\": [],\n \"refunded_money\": {},\n \"risk_evaluation\": {\n \"created_at\": \"\",\n \"risk_level\": \"\"\n },\n \"shipping_address\": {},\n \"source_type\": \"\",\n \"statement_description_identifier\": \"\",\n \"status\": \"\",\n \"tip_money\": {},\n \"total_money\": {},\n \"updated_at\": \"\",\n \"version_token\": \"\",\n \"wallet_details\": {\n \"status\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/payments/:payment_id";
let payload = json!({
"idempotency_key": "",
"payment": json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"app_fee_money": json!({}),
"approved_money": json!({}),
"bank_account_details": json!({
"account_ownership_type": "",
"ach_details": json!({
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
}),
"bank_name": "",
"country": "",
"errors": (
json!({
"category": "",
"code": "",
"detail": "",
"field": ""
})
),
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
}),
"billing_address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"buyer_email_address": "",
"capabilities": (),
"card_details": json!({
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": json!({
"billing_address": json!({}),
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
}),
"card_payment_timeline": json!({
"authorized_at": "",
"captured_at": "",
"voided_at": ""
}),
"cvv_status": "",
"device_details": json!({
"device_id": "",
"device_installation_id": "",
"device_name": ""
}),
"entry_method": "",
"errors": (json!({})),
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
}),
"cash_details": json!({
"buyer_supplied_money": json!({}),
"change_back_money": json!({})
}),
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": json!({
"source": "",
"source_fee_money": json!({}),
"source_id": "",
"type": ""
}),
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": (
json!({
"amount_money": json!({}),
"effective_at": "",
"type": ""
})
),
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": (),
"refunded_money": json!({}),
"risk_evaluation": json!({
"created_at": "",
"risk_level": ""
}),
"shipping_address": json!({}),
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": json!({}),
"total_money": json!({}),
"updated_at": "",
"version_token": "",
"wallet_details": json!({"status": ""})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/payments/:payment_id \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"payment": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"approved_money": {},
"bank_account_details": {
"account_ownership_type": "",
"ach_details": {
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
},
"bank_name": "",
"country": "",
"errors": [
{
"category": "",
"code": "",
"detail": "",
"field": ""
}
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"capabilities": [],
"card_details": {
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"card_payment_timeline": {
"authorized_at": "",
"captured_at": "",
"voided_at": ""
},
"cvv_status": "",
"device_details": {
"device_id": "",
"device_installation_id": "",
"device_name": ""
},
"entry_method": "",
"errors": [
{}
],
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
},
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
{
"amount_money": {},
"effective_at": "",
"type": ""
}
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": {},
"risk_evaluation": {
"created_at": "",
"risk_level": ""
},
"shipping_address": {},
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": {},
"total_money": {},
"updated_at": "",
"version_token": "",
"wallet_details": {
"status": ""
}
}
}'
echo '{
"idempotency_key": "",
"payment": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"approved_money": {},
"bank_account_details": {
"account_ownership_type": "",
"ach_details": {
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
},
"bank_name": "",
"country": "",
"errors": [
{
"category": "",
"code": "",
"detail": "",
"field": ""
}
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"capabilities": [],
"card_details": {
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": {
"billing_address": {},
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
},
"card_payment_timeline": {
"authorized_at": "",
"captured_at": "",
"voided_at": ""
},
"cvv_status": "",
"device_details": {
"device_id": "",
"device_installation_id": "",
"device_name": ""
},
"entry_method": "",
"errors": [
{}
],
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
},
"cash_details": {
"buyer_supplied_money": {},
"change_back_money": {}
},
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": {
"source": "",
"source_fee_money": {},
"source_id": "",
"type": ""
},
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
{
"amount_money": {},
"effective_at": "",
"type": ""
}
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": {},
"risk_evaluation": {
"created_at": "",
"risk_level": ""
},
"shipping_address": {},
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": {},
"total_money": {},
"updated_at": "",
"version_token": "",
"wallet_details": {
"status": ""
}
}
}' | \
http PUT {{baseUrl}}/v2/payments/:payment_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "payment": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_fee_money": {},\n "approved_money": {},\n "bank_account_details": {\n "account_ownership_type": "",\n "ach_details": {\n "account_number_suffix": "",\n "account_type": "",\n "routing_number": ""\n },\n "bank_name": "",\n "country": "",\n "errors": [\n {\n "category": "",\n "code": "",\n "detail": "",\n "field": ""\n }\n ],\n "fingerprint": "",\n "statement_description": "",\n "transfer_type": ""\n },\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "buyer_email_address": "",\n "capabilities": [],\n "card_details": {\n "application_cryptogram": "",\n "application_identifier": "",\n "application_name": "",\n "auth_result_code": "",\n "avs_status": "",\n "card": {\n "billing_address": {},\n "bin": "",\n "card_brand": "",\n "card_type": "",\n "cardholder_name": "",\n "customer_id": "",\n "enabled": false,\n "exp_month": 0,\n "exp_year": 0,\n "fingerprint": "",\n "id": "",\n "last_4": "",\n "prepaid_type": "",\n "reference_id": "",\n "version": 0\n },\n "card_payment_timeline": {\n "authorized_at": "",\n "captured_at": "",\n "voided_at": ""\n },\n "cvv_status": "",\n "device_details": {\n "device_id": "",\n "device_installation_id": "",\n "device_name": ""\n },\n "entry_method": "",\n "errors": [\n {}\n ],\n "refund_requires_card_presence": false,\n "statement_description": "",\n "status": "",\n "verification_method": "",\n "verification_results": ""\n },\n "cash_details": {\n "buyer_supplied_money": {},\n "change_back_money": {}\n },\n "created_at": "",\n "customer_id": "",\n "delay_action": "",\n "delay_duration": "",\n "delayed_until": "",\n "employee_id": "",\n "external_details": {\n "source": "",\n "source_fee_money": {},\n "source_id": "",\n "type": ""\n },\n "id": "",\n "location_id": "",\n "note": "",\n "order_id": "",\n "processing_fee": [\n {\n "amount_money": {},\n "effective_at": "",\n "type": ""\n }\n ],\n "receipt_number": "",\n "receipt_url": "",\n "reference_id": "",\n "refund_ids": [],\n "refunded_money": {},\n "risk_evaluation": {\n "created_at": "",\n "risk_level": ""\n },\n "shipping_address": {},\n "source_type": "",\n "statement_description_identifier": "",\n "status": "",\n "tip_money": {},\n "total_money": {},\n "updated_at": "",\n "version_token": "",\n "wallet_details": {\n "status": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/payments/:payment_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"payment": [
"amount_money": [
"amount": 0,
"currency": ""
],
"app_fee_money": [],
"approved_money": [],
"bank_account_details": [
"account_ownership_type": "",
"ach_details": [
"account_number_suffix": "",
"account_type": "",
"routing_number": ""
],
"bank_name": "",
"country": "",
"errors": [
[
"category": "",
"code": "",
"detail": "",
"field": ""
]
],
"fingerprint": "",
"statement_description": "",
"transfer_type": ""
],
"billing_address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"buyer_email_address": "",
"capabilities": [],
"card_details": [
"application_cryptogram": "",
"application_identifier": "",
"application_name": "",
"auth_result_code": "",
"avs_status": "",
"card": [
"billing_address": [],
"bin": "",
"card_brand": "",
"card_type": "",
"cardholder_name": "",
"customer_id": "",
"enabled": false,
"exp_month": 0,
"exp_year": 0,
"fingerprint": "",
"id": "",
"last_4": "",
"prepaid_type": "",
"reference_id": "",
"version": 0
],
"card_payment_timeline": [
"authorized_at": "",
"captured_at": "",
"voided_at": ""
],
"cvv_status": "",
"device_details": [
"device_id": "",
"device_installation_id": "",
"device_name": ""
],
"entry_method": "",
"errors": [[]],
"refund_requires_card_presence": false,
"statement_description": "",
"status": "",
"verification_method": "",
"verification_results": ""
],
"cash_details": [
"buyer_supplied_money": [],
"change_back_money": []
],
"created_at": "",
"customer_id": "",
"delay_action": "",
"delay_duration": "",
"delayed_until": "",
"employee_id": "",
"external_details": [
"source": "",
"source_fee_money": [],
"source_id": "",
"type": ""
],
"id": "",
"location_id": "",
"note": "",
"order_id": "",
"processing_fee": [
[
"amount_money": [],
"effective_at": "",
"type": ""
]
],
"receipt_number": "",
"receipt_url": "",
"reference_id": "",
"refund_ids": [],
"refunded_money": [],
"risk_evaluation": [
"created_at": "",
"risk_level": ""
],
"shipping_address": [],
"source_type": "",
"statement_description_identifier": "",
"status": "",
"tip_money": [],
"total_money": [],
"updated_at": "",
"version_token": "",
"wallet_details": ["status": ""]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/payments/:payment_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"payment": {
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"approved_money": {
"amount": 1000,
"currency": "USD"
},
"capabilities": [
"EDIT_AMOUNT_UP",
"EDIT_AMOUNT_DOWN",
"EDIT_TIP_AMOUNT_UP",
"EDIT_TIP_AMOUNT_DOWN"
],
"card_details": {
"auth_result_code": "ajM2ZF",
"avs_status": "AVS_ACCEPTED",
"card": {
"bin": "411111",
"card_brand": "VISA",
"card_type": "CREDIT",
"exp_month": 2,
"exp_year": 2022,
"fingerprint": "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ",
"last_4": "1111"
},
"card_payment_timeline": {
"authorized_at": "2021-02-24T03:33:43.681Z"
},
"cvv_status": "CVV_ACCEPTED",
"entry_method": "KEYED",
"statement_description": "SQ *MY BUSINESS GOSQ.COM",
"status": "AUTHORIZED"
},
"created_at": "2021-03-02T19:53:31.055Z",
"delay_action": "CANCEL",
"delay_duration": "PT168H",
"delayed_until": "2021-03-09T19:53:31.055Z",
"id": "XllelosAAfmkf9mOa0YB4PqSZACZY",
"location_id": "XTI0H92143A39",
"order_id": "B6qiKWus1d3TBoN2Qn5kfDiWZlfZY",
"receipt_number": "Xlle",
"source_type": "CARD",
"status": "APPROVED",
"tip_money": {
"amount": 300,
"currency": "USD"
},
"total_money": {
"amount": 1300,
"currency": "USD"
},
"updated_at": "2021-03-02T19:53:31.164Z",
"version_token": "9TKsTawsWZvdZZD5uhAZFWfd3chxFXB49cgFpD2Kujf6o"
}
}
GET
GetPaymentRefund
{{baseUrl}}/v2/refunds/:refund_id
QUERY PARAMS
refund_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/refunds/:refund_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/refunds/:refund_id")
require "http/client"
url = "{{baseUrl}}/v2/refunds/:refund_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/refunds/:refund_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/refunds/:refund_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/refunds/:refund_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/refunds/:refund_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/refunds/:refund_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/refunds/:refund_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/refunds/:refund_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/refunds/:refund_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/refunds/:refund_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/refunds/:refund_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/refunds/:refund_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/refunds/:refund_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/refunds/:refund_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/refunds/:refund_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/refunds/:refund_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/refunds/:refund_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/refunds/:refund_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/refunds/:refund_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/refunds/:refund_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/refunds/:refund_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/refunds/:refund_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/refunds/:refund_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/refunds/:refund_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/refunds/:refund_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/refunds/:refund_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/refunds/:refund_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/refunds/:refund_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/refunds/:refund_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/refunds/:refund_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/refunds/:refund_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/refunds/:refund_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/refunds/:refund_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/refunds/:refund_id
http GET {{baseUrl}}/v2/refunds/:refund_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/refunds/:refund_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/refunds/:refund_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"refund": {
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"created_at": "2019-07-06T18:01:22.123Z",
"id": "O2QAAhTYs7rUfzlxT38GMO7LvaB_q7JwCHtxmgXrh8fAhV468WQ44VxDtL7CU4yVRlsbXmI",
"location_id": "XK3DBG77NJBFX",
"order_id": "2duiyoqbfeXY0DBi15GEyk5Epa4F",
"payment_id": "O2QAAhTYs7rUfzlxT38GMO7LvaB",
"processing_fee": [
{
"amount_money": {
"amount": -59,
"currency": "USD"
},
"effective_at": "2019-07-06T20:01:12.000Z",
"type": "INITIAL"
}
],
"status": "COMPLETED",
"updated_at": "2019-07-06T18:06:03.874Z"
}
}
GET
ListPaymentRefunds
{{baseUrl}}/v2/refunds
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/refunds");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/refunds")
require "http/client"
url = "{{baseUrl}}/v2/refunds"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/refunds"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/refunds");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/refunds"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/refunds HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/refunds")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/refunds"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/refunds")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/refunds")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/refunds');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/refunds'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/refunds';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/refunds',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/refunds")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/refunds',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/refunds'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/refunds');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/refunds'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/refunds';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/refunds"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/refunds" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/refunds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/refunds');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/refunds');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/refunds');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/refunds' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/refunds' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/refunds")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/refunds"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/refunds"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/refunds') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/refunds";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/refunds
http GET {{baseUrl}}/v2/refunds
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/refunds
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/refunds")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "5evquW1YswHoT4EoyUhzMmTsCnsSXBU9U0WJ4FU4623nrMQcocH0RGU6Up1YkwfiMcF59ood58EBTEGgzMTGHQJpocic7ExOL0NtrTXCeWcv0UJIJNk8eXb",
"refunds": [
{
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"created_at": "2019-07-06T18:01:22.335Z",
"id": "O2QAAhTYs7rUfzlxT38GMO7LvaB_q7JwCHtxmgXrh8fAhV468WQ44VxDtL7CU4yVRlsbXmI",
"location_id": "XK3DBG77NJBFX",
"order_id": "2duiyoqbfeXY0DBi15GEyk5Epa4F",
"payment_id": "O2QAAhTYs7rUfzlxT38GMO7LvaB",
"processing_fee": [
{
"amount_money": {
"amount": -59,
"currency": "USD"
},
"effective_at": "2019-07-06T20:01:12.000Z",
"type": "INITIAL"
}
],
"status": "COMPLETED",
"updated_at": "2019-07-06T18:06:04.653Z"
},
{
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"created_at": "2019-07-06T17:01:54.232Z",
"id": "8TDIQvFw8PeDIxhSfd5yyX7GuaB_13px5Vrz01qzzuoGzmjsZIxDjfHhbkm2XppBUX1dW7I",
"location_id": "XK3DBG77NJBFX",
"order_id": "w6EXfEwS03oTQsnZTCqfE6f67e4F",
"payment_id": "8TDIQvFw8PeDIxhSfd5yyX7GuaB",
"processing_fee": [
{
"amount_money": {
"amount": -59,
"currency": "USD"
},
"effective_at": "2019-07-06T19:01:45.000Z",
"type": "INITIAL"
}
],
"status": "COMPLETED",
"updated_at": "2019-07-06T17:21:04.684Z"
}
]
}
POST
RefundPayment
{{baseUrl}}/v2/refunds
BODY json
{
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"idempotency_key": "",
"payment_id": "",
"reason": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/refunds");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/refunds" {:content-type :json
:form-params {:amount_money {:amount 0
:currency ""}
:app_fee_money {}
:idempotency_key ""
:payment_id ""
:reason ""}})
require "http/client"
url = "{{baseUrl}}/v2/refunds"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/refunds"),
Content = new StringContent("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/refunds");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/refunds"
payload := strings.NewReader("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/refunds HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 147
{
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"idempotency_key": "",
"payment_id": "",
"reason": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/refunds")
.setHeader("content-type", "application/json")
.setBody("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/refunds"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/refunds")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/refunds")
.header("content-type", "application/json")
.body("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}")
.asString();
const data = JSON.stringify({
amount_money: {
amount: 0,
currency: ''
},
app_fee_money: {},
idempotency_key: '',
payment_id: '',
reason: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/refunds');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/refunds',
headers: {'content-type': 'application/json'},
data: {
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
idempotency_key: '',
payment_id: '',
reason: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/refunds';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"amount_money":{"amount":0,"currency":""},"app_fee_money":{},"idempotency_key":"","payment_id":"","reason":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/refunds',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_fee_money": {},\n "idempotency_key": "",\n "payment_id": "",\n "reason": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/refunds")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/refunds',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
idempotency_key: '',
payment_id: '',
reason: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/refunds',
headers: {'content-type': 'application/json'},
body: {
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
idempotency_key: '',
payment_id: '',
reason: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/refunds');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
amount_money: {
amount: 0,
currency: ''
},
app_fee_money: {},
idempotency_key: '',
payment_id: '',
reason: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/refunds',
headers: {'content-type': 'application/json'},
data: {
amount_money: {amount: 0, currency: ''},
app_fee_money: {},
idempotency_key: '',
payment_id: '',
reason: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/refunds';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"amount_money":{"amount":0,"currency":""},"app_fee_money":{},"idempotency_key":"","payment_id":"","reason":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"amount_money": @{ @"amount": @0, @"currency": @"" },
@"app_fee_money": @{ },
@"idempotency_key": @"",
@"payment_id": @"",
@"reason": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/refunds"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/refunds" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/refunds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'idempotency_key' => '',
'payment_id' => '',
'reason' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/refunds', [
'body' => '{
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"idempotency_key": "",
"payment_id": "",
"reason": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/refunds');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'idempotency_key' => '',
'payment_id' => '',
'reason' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_fee_money' => [
],
'idempotency_key' => '',
'payment_id' => '',
'reason' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/refunds');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/refunds' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"idempotency_key": "",
"payment_id": "",
"reason": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/refunds' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"idempotency_key": "",
"payment_id": "",
"reason": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/refunds", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/refunds"
payload = {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"idempotency_key": "",
"payment_id": "",
"reason": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/refunds"
payload <- "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/refunds') do |req|
req.body = "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_fee_money\": {},\n \"idempotency_key\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/refunds";
let payload = json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"app_fee_money": json!({}),
"idempotency_key": "",
"payment_id": "",
"reason": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/refunds \
--header 'content-type: application/json' \
--data '{
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"idempotency_key": "",
"payment_id": "",
"reason": ""
}'
echo '{
"amount_money": {
"amount": 0,
"currency": ""
},
"app_fee_money": {},
"idempotency_key": "",
"payment_id": "",
"reason": ""
}' | \
http POST {{baseUrl}}/v2/refunds \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_fee_money": {},\n "idempotency_key": "",\n "payment_id": "",\n "reason": ""\n}' \
--output-document \
- {{baseUrl}}/v2/refunds
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"amount_money": [
"amount": 0,
"currency": ""
],
"app_fee_money": [],
"idempotency_key": "",
"payment_id": "",
"reason": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/refunds")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"refund": {
"amount_money": {
"amount": 100,
"currency": "USD"
},
"created_at": "2018-10-17T20:41:55.520Z",
"id": "UNOE3kv2BZwqHlJ830RCt5YCuaB_xVteEWVFkXDvKN1ddidfJWipt8p9whmElKT5mZtJ7wZ",
"payment_id": "UNOE3kv2BZwqHlJ830RCt5YCuaB",
"status": "PENDING",
"updated_at": "2018-10-17T20:41:55.520Z"
}
}
GET
ListSites
{{baseUrl}}/v2/sites
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/sites");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/sites")
require "http/client"
url = "{{baseUrl}}/v2/sites"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/sites"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/sites");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/sites"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/sites HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/sites")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/sites"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/sites")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/sites")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/sites');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/sites'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/sites';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/sites',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/sites")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/sites',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/sites'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/sites');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/sites'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/sites';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/sites"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/sites" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/sites",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/sites');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/sites');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/sites');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/sites' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/sites' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/sites")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/sites"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/sites"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/sites")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/sites') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/sites";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/sites
http GET {{baseUrl}}/v2/sites
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/sites
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/sites")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"sites": [
{
"created_at": "2020-02-28T13:22:51Z",
"domain": "mysite1.square.site",
"id": "site_278075276488921835",
"is_published": true,
"site_title": "My First Site",
"updated_at": "2021-01-13T09:58:32Z"
},
{
"created_at": "2020-06-18T17:45:13Z",
"domain": "mysite2.square.site",
"id": "site_102725345836253849",
"is_published": true,
"site_title": "My Second Site",
"updated_at": "2020-11-23T02:19:10Z"
}
]
}
DELETE
DeleteSnippet
{{baseUrl}}/v2/sites/:site_id/snippet
QUERY PARAMS
site_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/sites/:site_id/snippet");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/sites/:site_id/snippet")
require "http/client"
url = "{{baseUrl}}/v2/sites/:site_id/snippet"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/sites/:site_id/snippet"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/sites/:site_id/snippet");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/sites/:site_id/snippet"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/sites/:site_id/snippet HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/sites/:site_id/snippet")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/sites/:site_id/snippet"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/sites/:site_id/snippet")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/sites/:site_id/snippet")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v2/sites/:site_id/snippet');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/sites/:site_id/snippet'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/sites/:site_id/snippet';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/sites/:site_id/snippet',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/sites/:site_id/snippet")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/sites/:site_id/snippet',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/sites/:site_id/snippet'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/sites/:site_id/snippet');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/sites/:site_id/snippet'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/sites/:site_id/snippet';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/sites/:site_id/snippet"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/sites/:site_id/snippet" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/sites/:site_id/snippet",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/sites/:site_id/snippet');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/sites/:site_id/snippet');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/sites/:site_id/snippet');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/sites/:site_id/snippet' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/sites/:site_id/snippet' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/sites/:site_id/snippet")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/sites/:site_id/snippet"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/sites/:site_id/snippet"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/sites/:site_id/snippet")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/sites/:site_id/snippet') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/sites/:site_id/snippet";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/sites/:site_id/snippet
http DELETE {{baseUrl}}/v2/sites/:site_id/snippet
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/sites/:site_id/snippet
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/sites/:site_id/snippet")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
GET
RetrieveSnippet
{{baseUrl}}/v2/sites/:site_id/snippet
QUERY PARAMS
site_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/sites/:site_id/snippet");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/sites/:site_id/snippet")
require "http/client"
url = "{{baseUrl}}/v2/sites/:site_id/snippet"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/sites/:site_id/snippet"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/sites/:site_id/snippet");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/sites/:site_id/snippet"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/sites/:site_id/snippet HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/sites/:site_id/snippet")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/sites/:site_id/snippet"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/sites/:site_id/snippet")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/sites/:site_id/snippet")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/sites/:site_id/snippet');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/sites/:site_id/snippet'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/sites/:site_id/snippet';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/sites/:site_id/snippet',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/sites/:site_id/snippet")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/sites/:site_id/snippet',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v2/sites/:site_id/snippet'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/sites/:site_id/snippet');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v2/sites/:site_id/snippet'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/sites/:site_id/snippet';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/sites/:site_id/snippet"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/sites/:site_id/snippet" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/sites/:site_id/snippet",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/sites/:site_id/snippet');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/sites/:site_id/snippet');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/sites/:site_id/snippet');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/sites/:site_id/snippet' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/sites/:site_id/snippet' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/sites/:site_id/snippet")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/sites/:site_id/snippet"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/sites/:site_id/snippet"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/sites/:site_id/snippet")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/sites/:site_id/snippet') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/sites/:site_id/snippet";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/sites/:site_id/snippet
http GET {{baseUrl}}/v2/sites/:site_id/snippet
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/sites/:site_id/snippet
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/sites/:site_id/snippet")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"snippet": {
"content": "",
"created_at": "2021-03-11T25:40:09Z",
"id": "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7",
"site_id": "site_278075276488921835",
"updated_at": "2021-03-11T25:40:09Z"
}
}
POST
UpsertSnippet
{{baseUrl}}/v2/sites/:site_id/snippet
QUERY PARAMS
site_id
BODY json
{
"snippet": {
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/sites/:site_id/snippet");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/sites/:site_id/snippet" {:content-type :json
:form-params {:snippet {:content ""
:created_at ""
:id ""
:site_id ""
:updated_at ""}}})
require "http/client"
url = "{{baseUrl}}/v2/sites/:site_id/snippet"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/sites/:site_id/snippet"),
Content = new StringContent("{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/sites/:site_id/snippet");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/sites/:site_id/snippet"
payload := strings.NewReader("{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/sites/:site_id/snippet HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 117
{
"snippet": {
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/sites/:site_id/snippet")
.setHeader("content-type", "application/json")
.setBody("{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/sites/:site_id/snippet"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/sites/:site_id/snippet")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/sites/:site_id/snippet")
.header("content-type", "application/json")
.body("{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
snippet: {
content: '',
created_at: '',
id: '',
site_id: '',
updated_at: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/sites/:site_id/snippet');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/sites/:site_id/snippet',
headers: {'content-type': 'application/json'},
data: {snippet: {content: '', created_at: '', id: '', site_id: '', updated_at: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/sites/:site_id/snippet';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"snippet":{"content":"","created_at":"","id":"","site_id":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/sites/:site_id/snippet',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "snippet": {\n "content": "",\n "created_at": "",\n "id": "",\n "site_id": "",\n "updated_at": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/sites/:site_id/snippet")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/sites/:site_id/snippet',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({snippet: {content: '', created_at: '', id: '', site_id: '', updated_at: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/sites/:site_id/snippet',
headers: {'content-type': 'application/json'},
body: {snippet: {content: '', created_at: '', id: '', site_id: '', updated_at: ''}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/sites/:site_id/snippet');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
snippet: {
content: '',
created_at: '',
id: '',
site_id: '',
updated_at: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/sites/:site_id/snippet',
headers: {'content-type': 'application/json'},
data: {snippet: {content: '', created_at: '', id: '', site_id: '', updated_at: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/sites/:site_id/snippet';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"snippet":{"content":"","created_at":"","id":"","site_id":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"snippet": @{ @"content": @"", @"created_at": @"", @"id": @"", @"site_id": @"", @"updated_at": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/sites/:site_id/snippet"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/sites/:site_id/snippet" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/sites/:site_id/snippet",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'snippet' => [
'content' => '',
'created_at' => '',
'id' => '',
'site_id' => '',
'updated_at' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/sites/:site_id/snippet', [
'body' => '{
"snippet": {
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/sites/:site_id/snippet');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'snippet' => [
'content' => '',
'created_at' => '',
'id' => '',
'site_id' => '',
'updated_at' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'snippet' => [
'content' => '',
'created_at' => '',
'id' => '',
'site_id' => '',
'updated_at' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/sites/:site_id/snippet');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/sites/:site_id/snippet' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"snippet": {
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/sites/:site_id/snippet' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"snippet": {
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/sites/:site_id/snippet", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/sites/:site_id/snippet"
payload = { "snippet": {
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/sites/:site_id/snippet"
payload <- "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/sites/:site_id/snippet")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/sites/:site_id/snippet') do |req|
req.body = "{\n \"snippet\": {\n \"content\": \"\",\n \"created_at\": \"\",\n \"id\": \"\",\n \"site_id\": \"\",\n \"updated_at\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/sites/:site_id/snippet";
let payload = json!({"snippet": json!({
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/sites/:site_id/snippet \
--header 'content-type: application/json' \
--data '{
"snippet": {
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
}
}'
echo '{
"snippet": {
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
}
}' | \
http POST {{baseUrl}}/v2/sites/:site_id/snippet \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "snippet": {\n "content": "",\n "created_at": "",\n "id": "",\n "site_id": "",\n "updated_at": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/sites/:site_id/snippet
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["snippet": [
"content": "",
"created_at": "",
"id": "",
"site_id": "",
"updated_at": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/sites/:site_id/snippet")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"snippet": {
"content": "",
"created_at": "2021-03-11T25:40:09Z",
"id": "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7",
"site_id": "site_278075276488921835",
"updated_at": "2021-03-11T25:40:09Z"
}
}
POST
CancelSubscription
{{baseUrl}}/v2/subscriptions/:subscription_id/cancel
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel")
require "http/client"
url = "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/subscriptions/:subscription_id/cancel"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/subscriptions/:subscription_id/cancel");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/subscriptions/:subscription_id/cancel HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/subscriptions/:subscription_id/cancel"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id/cancel")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/subscriptions/:subscription_id/cancel")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id/cancel")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/subscriptions/:subscription_id/cancel',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/subscriptions/:subscription_id/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/subscriptions/:subscription_id/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/subscriptions/:subscription_id/cancel');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/subscriptions/:subscription_id/cancel');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id/cancel' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/subscriptions/:subscription_id/cancel")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/subscriptions/:subscription_id/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/subscriptions/:subscription_id/cancel') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/subscriptions/:subscription_id/cancel
http POST {{baseUrl}}/v2/subscriptions/:subscription_id/cancel
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/subscriptions/:subscription_id/cancel
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/subscriptions/:subscription_id/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": {
"canceled_date": "2020-05-01",
"card_id": "ccof:qy5x8hHGYsgLrp4Q4GB",
"created_at": "2020-08-03T21:53:10Z",
"customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G",
"id": "910afd30-464a-4e00-a8d8-2296eEXAMPLE",
"location_id": "S8GWD5R9QB376",
"paid_until_date": "2020-05-01",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"start_date": "2020-04-24",
"status": "ACTIVE",
"timezone": "America/Los_Angeles",
"version": 1594311617331
}
}
POST
CreateSubscription
{{baseUrl}}/v2/subscriptions
BODY json
{
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"tax_percentage": "",
"timezone": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/subscriptions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/subscriptions" {:content-type :json
:form-params {:canceled_date ""
:card_id ""
:customer_id ""
:idempotency_key ""
:location_id ""
:plan_id ""
:price_override_money {:amount 0
:currency ""}
:start_date ""
:tax_percentage ""
:timezone ""}})
require "http/client"
url = "{{baseUrl}}/v2/subscriptions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/subscriptions"),
Content = new StringContent("{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/subscriptions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/subscriptions"
payload := strings.NewReader("{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/subscriptions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 257
{
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"tax_percentage": "",
"timezone": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/subscriptions")
.setHeader("content-type", "application/json")
.setBody("{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/subscriptions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/subscriptions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/subscriptions")
.header("content-type", "application/json")
.body("{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}")
.asString();
const data = JSON.stringify({
canceled_date: '',
card_id: '',
customer_id: '',
idempotency_key: '',
location_id: '',
plan_id: '',
price_override_money: {
amount: 0,
currency: ''
},
start_date: '',
tax_percentage: '',
timezone: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/subscriptions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions',
headers: {'content-type': 'application/json'},
data: {
canceled_date: '',
card_id: '',
customer_id: '',
idempotency_key: '',
location_id: '',
plan_id: '',
price_override_money: {amount: 0, currency: ''},
start_date: '',
tax_percentage: '',
timezone: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/subscriptions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"canceled_date":"","card_id":"","customer_id":"","idempotency_key":"","location_id":"","plan_id":"","price_override_money":{"amount":0,"currency":""},"start_date":"","tax_percentage":"","timezone":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/subscriptions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "canceled_date": "",\n "card_id": "",\n "customer_id": "",\n "idempotency_key": "",\n "location_id": "",\n "plan_id": "",\n "price_override_money": {\n "amount": 0,\n "currency": ""\n },\n "start_date": "",\n "tax_percentage": "",\n "timezone": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/subscriptions")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/subscriptions',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
canceled_date: '',
card_id: '',
customer_id: '',
idempotency_key: '',
location_id: '',
plan_id: '',
price_override_money: {amount: 0, currency: ''},
start_date: '',
tax_percentage: '',
timezone: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions',
headers: {'content-type': 'application/json'},
body: {
canceled_date: '',
card_id: '',
customer_id: '',
idempotency_key: '',
location_id: '',
plan_id: '',
price_override_money: {amount: 0, currency: ''},
start_date: '',
tax_percentage: '',
timezone: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/subscriptions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
canceled_date: '',
card_id: '',
customer_id: '',
idempotency_key: '',
location_id: '',
plan_id: '',
price_override_money: {
amount: 0,
currency: ''
},
start_date: '',
tax_percentage: '',
timezone: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions',
headers: {'content-type': 'application/json'},
data: {
canceled_date: '',
card_id: '',
customer_id: '',
idempotency_key: '',
location_id: '',
plan_id: '',
price_override_money: {amount: 0, currency: ''},
start_date: '',
tax_percentage: '',
timezone: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/subscriptions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"canceled_date":"","card_id":"","customer_id":"","idempotency_key":"","location_id":"","plan_id":"","price_override_money":{"amount":0,"currency":""},"start_date":"","tax_percentage":"","timezone":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"canceled_date": @"",
@"card_id": @"",
@"customer_id": @"",
@"idempotency_key": @"",
@"location_id": @"",
@"plan_id": @"",
@"price_override_money": @{ @"amount": @0, @"currency": @"" },
@"start_date": @"",
@"tax_percentage": @"",
@"timezone": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/subscriptions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/subscriptions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'canceled_date' => '',
'card_id' => '',
'customer_id' => '',
'idempotency_key' => '',
'location_id' => '',
'plan_id' => '',
'price_override_money' => [
'amount' => 0,
'currency' => ''
],
'start_date' => '',
'tax_percentage' => '',
'timezone' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/subscriptions', [
'body' => '{
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"tax_percentage": "",
"timezone": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/subscriptions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'canceled_date' => '',
'card_id' => '',
'customer_id' => '',
'idempotency_key' => '',
'location_id' => '',
'plan_id' => '',
'price_override_money' => [
'amount' => 0,
'currency' => ''
],
'start_date' => '',
'tax_percentage' => '',
'timezone' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'canceled_date' => '',
'card_id' => '',
'customer_id' => '',
'idempotency_key' => '',
'location_id' => '',
'plan_id' => '',
'price_override_money' => [
'amount' => 0,
'currency' => ''
],
'start_date' => '',
'tax_percentage' => '',
'timezone' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/subscriptions');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/subscriptions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"tax_percentage": "",
"timezone": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/subscriptions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"tax_percentage": "",
"timezone": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/subscriptions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/subscriptions"
payload = {
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"tax_percentage": "",
"timezone": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/subscriptions"
payload <- "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/subscriptions') do |req|
req.body = "{\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"customer_id\": \"\",\n \"idempotency_key\": \"\",\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/subscriptions";
let payload = json!({
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": json!({
"amount": 0,
"currency": ""
}),
"start_date": "",
"tax_percentage": "",
"timezone": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/subscriptions \
--header 'content-type: application/json' \
--data '{
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"tax_percentage": "",
"timezone": ""
}'
echo '{
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"tax_percentage": "",
"timezone": ""
}' | \
http POST {{baseUrl}}/v2/subscriptions \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "canceled_date": "",\n "card_id": "",\n "customer_id": "",\n "idempotency_key": "",\n "location_id": "",\n "plan_id": "",\n "price_override_money": {\n "amount": 0,\n "currency": ""\n },\n "start_date": "",\n "tax_percentage": "",\n "timezone": ""\n}' \
--output-document \
- {{baseUrl}}/v2/subscriptions
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"canceled_date": "",
"card_id": "",
"customer_id": "",
"idempotency_key": "",
"location_id": "",
"plan_id": "",
"price_override_money": [
"amount": 0,
"currency": ""
],
"start_date": "",
"tax_percentage": "",
"timezone": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/subscriptions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": {
"card_id": "ccof:qy5x8hHGYsgLrp4Q4GB",
"created_at": "2020-08-03T21:53:10Z",
"customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G",
"id": "56214fb2-cc85-47a1-93bc-44f3766bb56f",
"location_id": "S8GWD5R9QB376",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"price_override_money": {
"amount": 100,
"currency": "USD"
},
"start_date": "2020-08-01",
"status": "PENDING",
"tax_percentage": "5",
"timezone": "America/Los_Angeles",
"version": 1594155459464
}
}
GET
ListSubscriptionEvents
{{baseUrl}}/v2/subscriptions/:subscription_id/events
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/subscriptions/:subscription_id/events");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/subscriptions/:subscription_id/events")
require "http/client"
url = "{{baseUrl}}/v2/subscriptions/:subscription_id/events"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/subscriptions/:subscription_id/events"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/subscriptions/:subscription_id/events");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/subscriptions/:subscription_id/events"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/subscriptions/:subscription_id/events HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/subscriptions/:subscription_id/events")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/subscriptions/:subscription_id/events"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id/events")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/subscriptions/:subscription_id/events")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/subscriptions/:subscription_id/events');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/events'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id/events';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/events',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id/events")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/subscriptions/:subscription_id/events',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/events'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/subscriptions/:subscription_id/events');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/events'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id/events';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/subscriptions/:subscription_id/events"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/subscriptions/:subscription_id/events" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/subscriptions/:subscription_id/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/subscriptions/:subscription_id/events');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/subscriptions/:subscription_id/events');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/subscriptions/:subscription_id/events');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id/events' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id/events' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/subscriptions/:subscription_id/events")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/subscriptions/:subscription_id/events"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/subscriptions/:subscription_id/events"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/subscriptions/:subscription_id/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/subscriptions/:subscription_id/events') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/subscriptions/:subscription_id/events";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/subscriptions/:subscription_id/events
http GET {{baseUrl}}/v2/subscriptions/:subscription_id/events
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/subscriptions/:subscription_id/events
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/subscriptions/:subscription_id/events")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription_events": [
{
"effective_date": "2020-04-24",
"id": "06809161-3867-4598-8269-8aea5be4f9de",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"subscription_event_type": "START_SUBSCRIPTION"
},
{
"effective_date": "2020-05-06",
"id": "a0c08083-5db0-4800-85c7-d398de4fbb6e",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"subscription_event_type": "STOP_SUBSCRIPTION"
}
]
}
POST
ResumeSubscription
{{baseUrl}}/v2/subscriptions/:subscription_id/resume
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/subscriptions/:subscription_id/resume");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/subscriptions/:subscription_id/resume")
require "http/client"
url = "{{baseUrl}}/v2/subscriptions/:subscription_id/resume"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/subscriptions/:subscription_id/resume"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/subscriptions/:subscription_id/resume");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/subscriptions/:subscription_id/resume"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/subscriptions/:subscription_id/resume HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/subscriptions/:subscription_id/resume")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/subscriptions/:subscription_id/resume"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id/resume")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/subscriptions/:subscription_id/resume")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/subscriptions/:subscription_id/resume');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/resume'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id/resume';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/resume',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id/resume")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/subscriptions/:subscription_id/resume',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/resume'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/subscriptions/:subscription_id/resume');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id/resume'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id/resume';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/subscriptions/:subscription_id/resume"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/subscriptions/:subscription_id/resume" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/subscriptions/:subscription_id/resume",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/subscriptions/:subscription_id/resume');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/subscriptions/:subscription_id/resume');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/subscriptions/:subscription_id/resume');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id/resume' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id/resume' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/subscriptions/:subscription_id/resume")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/subscriptions/:subscription_id/resume"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/subscriptions/:subscription_id/resume"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/subscriptions/:subscription_id/resume")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/subscriptions/:subscription_id/resume') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/subscriptions/:subscription_id/resume";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/subscriptions/:subscription_id/resume
http POST {{baseUrl}}/v2/subscriptions/:subscription_id/resume
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/subscriptions/:subscription_id/resume
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/subscriptions/:subscription_id/resume")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": {
"created_at": "2020-08-03T21:53:10Z",
"customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G",
"id": "9ba40961-995a-4a3d-8c53-048c40cafc13",
"location_id": "S8GWD5R9QB376",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"price_override_money": {
"amount": 2000,
"currency": "USD"
},
"status": "ACTIVE",
"timezone": "America/Los_Angeles",
"version": 1594311617331
}
}
GET
RetrieveSubscription
{{baseUrl}}/v2/subscriptions/:subscription_id
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/subscriptions/:subscription_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/subscriptions/:subscription_id")
require "http/client"
url = "{{baseUrl}}/v2/subscriptions/:subscription_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/subscriptions/:subscription_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/subscriptions/:subscription_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/subscriptions/:subscription_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/subscriptions/:subscription_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/subscriptions/:subscription_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/subscriptions/:subscription_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/subscriptions/:subscription_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/subscriptions/:subscription_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/subscriptions/:subscription_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/subscriptions/:subscription_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/subscriptions/:subscription_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/subscriptions/:subscription_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/subscriptions/:subscription_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/subscriptions/:subscription_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/subscriptions/:subscription_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/subscriptions/:subscription_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/subscriptions/:subscription_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/subscriptions/:subscription_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/subscriptions/:subscription_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/subscriptions/:subscription_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/subscriptions/:subscription_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/subscriptions/:subscription_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/subscriptions/:subscription_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/subscriptions/:subscription_id
http GET {{baseUrl}}/v2/subscriptions/:subscription_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/subscriptions/:subscription_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/subscriptions/:subscription_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": {
"charged_through_date": "2020-06-11",
"created_at": "2020-08-03T21:53:10Z",
"customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G",
"id": "8151fc89-da15-4eb9-a685-1a70883cebfc",
"invoice_ids": [
"grebK0Q_l8H4fqoMMVvt-Q",
"rcX_i3sNmHTGKhI4W2mceA"
],
"location_id": "S8GWD5R9QB376",
"paid_until_date": "2020-06-11",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"price_override_money": {
"amount": 1000,
"currency": "USD"
},
"start_date": "2020-05-11",
"status": "ACTIVE",
"timezone": "America/Los_Angeles"
}
}
POST
SearchSubscriptions
{{baseUrl}}/v2/subscriptions/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/subscriptions/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/subscriptions/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:filter {:customer_ids []
:location_ids []}}}})
require "http/client"
url = "{{baseUrl}}/v2/subscriptions/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/subscriptions/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/subscriptions/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/subscriptions/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/subscriptions/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 123
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/subscriptions/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/subscriptions/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/subscriptions/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
customer_ids: [],
location_ids: []
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/subscriptions/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/search',
headers: {'content-type': 'application/json'},
data: {cursor: '', limit: 0, query: {filter: {customer_ids: [], location_ids: []}}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/subscriptions/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"customer_ids":[],"location_ids":[]}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/subscriptions/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "customer_ids": [],\n "location_ids": []\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/subscriptions/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({cursor: '', limit: 0, query: {filter: {customer_ids: [], location_ids: []}}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/search',
headers: {'content-type': 'application/json'},
body: {cursor: '', limit: 0, query: {filter: {customer_ids: [], location_ids: []}}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/subscriptions/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
filter: {
customer_ids: [],
location_ids: []
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/subscriptions/search',
headers: {'content-type': 'application/json'},
data: {cursor: '', limit: 0, query: {filter: {customer_ids: [], location_ids: []}}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/subscriptions/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"customer_ids":[],"location_ids":[]}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"filter": @{ @"customer_ids": @[ ], @"location_ids": @[ ] } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/subscriptions/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/subscriptions/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/subscriptions/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'customer_ids' => [
],
'location_ids' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/subscriptions/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/subscriptions/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'customer_ids' => [
],
'location_ids' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'customer_ids' => [
],
'location_ids' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/subscriptions/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/subscriptions/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/subscriptions/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/subscriptions/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/subscriptions/search"
payload = {
"cursor": "",
"limit": 0,
"query": { "filter": {
"customer_ids": [],
"location_ids": []
} }
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/subscriptions/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/subscriptions/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/subscriptions/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"customer_ids\": [],\n \"location_ids\": []\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/subscriptions/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({"filter": json!({
"customer_ids": (),
"location_ids": ()
})})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/subscriptions/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
}
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"customer_ids": [],
"location_ids": []
}
}
}' | \
http POST {{baseUrl}}/v2/subscriptions/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "customer_ids": [],\n "location_ids": []\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/subscriptions/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": ["filter": [
"customer_ids": [],
"location_ids": []
]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/subscriptions/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscriptions": [
{
"canceled_date": "2020-04-14",
"card_id": "ccof:mueUsvgajChmjEbp4GB",
"charged_through_date": "2020-05-14",
"created_at": "2020-08-03T21:53:10Z",
"customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G",
"id": "de86fc96-8664-474b-af1a-abbe59cacf0e",
"location_id": "S8GWD5R9QB376",
"paid_until_date": "2020-05-14",
"plan_id": "L3TJVDHVBEQEGQDEZL2JJM7R",
"start_date": "2020-04-14",
"status": "CANCELED",
"timezone": "UTC"
},
{
"created_at": "2020-08-03T21:53:10Z",
"customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G",
"id": "56214fb2-cc85-47a1-93bc-44f3766bb56f",
"location_id": "S8GWD5R9QB376",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"price_override_money": {
"amount": 100,
"currency": "USD"
},
"start_date": "2020-08-01",
"status": "PENDING",
"tax_percentage": "5",
"timezone": "America/Los_Angeles",
"version": 1594155459464
},
{
"charged_through_date": "2020-06-11",
"created_at": "2020-08-03T21:53:10Z",
"customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G",
"id": "8151fc89-da15-4eb9-a685-1a70883cebfc",
"invoice_ids": [
"grebK0Q_l8H4fqoMMVvt-Q",
"rcX_i3sNmHTGKhI4W2mceA"
],
"location_id": "S8GWD5R9QB376",
"paid_until_date": "2020-06-11",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"price_override_money": {
"amount": 1000,
"currency": "USD"
},
"start_date": "2020-05-11",
"status": "ACTIVE",
"timezone": "America/Los_Angeles"
}
]
}
PUT
UpdateSubscription
{{baseUrl}}/v2/subscriptions/:subscription_id
QUERY PARAMS
subscription_id
BODY json
{
"subscription": {
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/subscriptions/:subscription_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/subscriptions/:subscription_id" {:content-type :json
:form-params {:subscription {:canceled_date ""
:card_id ""
:charged_through_date ""
:created_at ""
:customer_id ""
:id ""
:invoice_ids []
:location_id ""
:plan_id ""
:price_override_money {:amount 0
:currency ""}
:start_date ""
:status ""
:tax_percentage ""
:timezone ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/subscriptions/:subscription_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/subscriptions/:subscription_id"),
Content = new StringContent("{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/subscriptions/:subscription_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/subscriptions/:subscription_id"
payload := strings.NewReader("{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/subscriptions/:subscription_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 407
{
"subscription": {
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/subscriptions/:subscription_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/subscriptions/:subscription_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/subscriptions/:subscription_id")
.header("content-type", "application/json")
.body("{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
subscription: {
canceled_date: '',
card_id: '',
charged_through_date: '',
created_at: '',
customer_id: '',
id: '',
invoice_ids: [],
location_id: '',
plan_id: '',
price_override_money: {
amount: 0,
currency: ''
},
start_date: '',
status: '',
tax_percentage: '',
timezone: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/subscriptions/:subscription_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id',
headers: {'content-type': 'application/json'},
data: {
subscription: {
canceled_date: '',
card_id: '',
charged_through_date: '',
created_at: '',
customer_id: '',
id: '',
invoice_ids: [],
location_id: '',
plan_id: '',
price_override_money: {amount: 0, currency: ''},
start_date: '',
status: '',
tax_percentage: '',
timezone: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"subscription":{"canceled_date":"","card_id":"","charged_through_date":"","created_at":"","customer_id":"","id":"","invoice_ids":[],"location_id":"","plan_id":"","price_override_money":{"amount":0,"currency":""},"start_date":"","status":"","tax_percentage":"","timezone":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/subscriptions/:subscription_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "subscription": {\n "canceled_date": "",\n "card_id": "",\n "charged_through_date": "",\n "created_at": "",\n "customer_id": "",\n "id": "",\n "invoice_ids": [],\n "location_id": "",\n "plan_id": "",\n "price_override_money": {\n "amount": 0,\n "currency": ""\n },\n "start_date": "",\n "status": "",\n "tax_percentage": "",\n "timezone": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/subscriptions/:subscription_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/subscriptions/:subscription_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
subscription: {
canceled_date: '',
card_id: '',
charged_through_date: '',
created_at: '',
customer_id: '',
id: '',
invoice_ids: [],
location_id: '',
plan_id: '',
price_override_money: {amount: 0, currency: ''},
start_date: '',
status: '',
tax_percentage: '',
timezone: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id',
headers: {'content-type': 'application/json'},
body: {
subscription: {
canceled_date: '',
card_id: '',
charged_through_date: '',
created_at: '',
customer_id: '',
id: '',
invoice_ids: [],
location_id: '',
plan_id: '',
price_override_money: {amount: 0, currency: ''},
start_date: '',
status: '',
tax_percentage: '',
timezone: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/subscriptions/:subscription_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
subscription: {
canceled_date: '',
card_id: '',
charged_through_date: '',
created_at: '',
customer_id: '',
id: '',
invoice_ids: [],
location_id: '',
plan_id: '',
price_override_money: {
amount: 0,
currency: ''
},
start_date: '',
status: '',
tax_percentage: '',
timezone: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/subscriptions/:subscription_id',
headers: {'content-type': 'application/json'},
data: {
subscription: {
canceled_date: '',
card_id: '',
charged_through_date: '',
created_at: '',
customer_id: '',
id: '',
invoice_ids: [],
location_id: '',
plan_id: '',
price_override_money: {amount: 0, currency: ''},
start_date: '',
status: '',
tax_percentage: '',
timezone: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/subscriptions/:subscription_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"subscription":{"canceled_date":"","card_id":"","charged_through_date":"","created_at":"","customer_id":"","id":"","invoice_ids":[],"location_id":"","plan_id":"","price_override_money":{"amount":0,"currency":""},"start_date":"","status":"","tax_percentage":"","timezone":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"subscription": @{ @"canceled_date": @"", @"card_id": @"", @"charged_through_date": @"", @"created_at": @"", @"customer_id": @"", @"id": @"", @"invoice_ids": @[ ], @"location_id": @"", @"plan_id": @"", @"price_override_money": @{ @"amount": @0, @"currency": @"" }, @"start_date": @"", @"status": @"", @"tax_percentage": @"", @"timezone": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/subscriptions/:subscription_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/subscriptions/:subscription_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/subscriptions/:subscription_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'subscription' => [
'canceled_date' => '',
'card_id' => '',
'charged_through_date' => '',
'created_at' => '',
'customer_id' => '',
'id' => '',
'invoice_ids' => [
],
'location_id' => '',
'plan_id' => '',
'price_override_money' => [
'amount' => 0,
'currency' => ''
],
'start_date' => '',
'status' => '',
'tax_percentage' => '',
'timezone' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/subscriptions/:subscription_id', [
'body' => '{
"subscription": {
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/subscriptions/:subscription_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'subscription' => [
'canceled_date' => '',
'card_id' => '',
'charged_through_date' => '',
'created_at' => '',
'customer_id' => '',
'id' => '',
'invoice_ids' => [
],
'location_id' => '',
'plan_id' => '',
'price_override_money' => [
'amount' => 0,
'currency' => ''
],
'start_date' => '',
'status' => '',
'tax_percentage' => '',
'timezone' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'subscription' => [
'canceled_date' => '',
'card_id' => '',
'charged_through_date' => '',
'created_at' => '',
'customer_id' => '',
'id' => '',
'invoice_ids' => [
],
'location_id' => '',
'plan_id' => '',
'price_override_money' => [
'amount' => 0,
'currency' => ''
],
'start_date' => '',
'status' => '',
'tax_percentage' => '',
'timezone' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/subscriptions/:subscription_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"subscription": {
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/subscriptions/:subscription_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"subscription": {
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/subscriptions/:subscription_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/subscriptions/:subscription_id"
payload = { "subscription": {
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/subscriptions/:subscription_id"
payload <- "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/subscriptions/:subscription_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/subscriptions/:subscription_id') do |req|
req.body = "{\n \"subscription\": {\n \"canceled_date\": \"\",\n \"card_id\": \"\",\n \"charged_through_date\": \"\",\n \"created_at\": \"\",\n \"customer_id\": \"\",\n \"id\": \"\",\n \"invoice_ids\": [],\n \"location_id\": \"\",\n \"plan_id\": \"\",\n \"price_override_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"start_date\": \"\",\n \"status\": \"\",\n \"tax_percentage\": \"\",\n \"timezone\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/subscriptions/:subscription_id";
let payload = json!({"subscription": json!({
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": (),
"location_id": "",
"plan_id": "",
"price_override_money": json!({
"amount": 0,
"currency": ""
}),
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/subscriptions/:subscription_id \
--header 'content-type: application/json' \
--data '{
"subscription": {
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
}
}'
echo '{
"subscription": {
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": {
"amount": 0,
"currency": ""
},
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
}
}' | \
http PUT {{baseUrl}}/v2/subscriptions/:subscription_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "subscription": {\n "canceled_date": "",\n "card_id": "",\n "charged_through_date": "",\n "created_at": "",\n "customer_id": "",\n "id": "",\n "invoice_ids": [],\n "location_id": "",\n "plan_id": "",\n "price_override_money": {\n "amount": 0,\n "currency": ""\n },\n "start_date": "",\n "status": "",\n "tax_percentage": "",\n "timezone": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/subscriptions/:subscription_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["subscription": [
"canceled_date": "",
"card_id": "",
"charged_through_date": "",
"created_at": "",
"customer_id": "",
"id": "",
"invoice_ids": [],
"location_id": "",
"plan_id": "",
"price_override_money": [
"amount": 0,
"currency": ""
],
"start_date": "",
"status": "",
"tax_percentage": "",
"timezone": "",
"version": 0
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/subscriptions/:subscription_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": {
"created_at": "2020-08-03T21:53:10Z",
"customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G",
"id": "9ba40961-995a-4a3d-8c53-048c40cafc13",
"location_id": "S8GWD5R9QB376",
"plan_id": "6JHXF3B2CW3YKHDV4XEM674H",
"price_override_money": {
"amount": 2000,
"currency": "USD"
},
"status": "ACTIVE",
"timezone": "America/Los_Angeles",
"version": 1594311617331
}
}
POST
BulkCreateTeamMembers
{{baseUrl}}/v2/team-members/bulk-create
BODY json
{
"team_members": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/team-members/bulk-create");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"team_members\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/team-members/bulk-create" {:content-type :json
:form-params {:team_members {}}})
require "http/client"
url = "{{baseUrl}}/v2/team-members/bulk-create"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"team_members\": {}\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/team-members/bulk-create"),
Content = new StringContent("{\n \"team_members\": {}\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/team-members/bulk-create");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"team_members\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/team-members/bulk-create"
payload := strings.NewReader("{\n \"team_members\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/team-members/bulk-create HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 24
{
"team_members": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/team-members/bulk-create")
.setHeader("content-type", "application/json")
.setBody("{\n \"team_members\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/team-members/bulk-create"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"team_members\": {}\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"team_members\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/team-members/bulk-create")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/team-members/bulk-create")
.header("content-type", "application/json")
.body("{\n \"team_members\": {}\n}")
.asString();
const data = JSON.stringify({
team_members: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/team-members/bulk-create');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/bulk-create',
headers: {'content-type': 'application/json'},
data: {team_members: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/team-members/bulk-create';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"team_members":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/team-members/bulk-create',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "team_members": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"team_members\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/team-members/bulk-create")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/team-members/bulk-create',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({team_members: {}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/bulk-create',
headers: {'content-type': 'application/json'},
body: {team_members: {}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/team-members/bulk-create');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
team_members: {}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/bulk-create',
headers: {'content-type': 'application/json'},
data: {team_members: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/team-members/bulk-create';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"team_members":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"team_members": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/team-members/bulk-create"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/team-members/bulk-create" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"team_members\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/team-members/bulk-create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'team_members' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/team-members/bulk-create', [
'body' => '{
"team_members": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/team-members/bulk-create');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'team_members' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'team_members' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/team-members/bulk-create');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/team-members/bulk-create' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"team_members": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/team-members/bulk-create' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"team_members": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"team_members\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/team-members/bulk-create", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/team-members/bulk-create"
payload = { "team_members": {} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/team-members/bulk-create"
payload <- "{\n \"team_members\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/team-members/bulk-create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"team_members\": {}\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/team-members/bulk-create') do |req|
req.body = "{\n \"team_members\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/team-members/bulk-create";
let payload = json!({"team_members": json!({})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/team-members/bulk-create \
--header 'content-type: application/json' \
--data '{
"team_members": {}
}'
echo '{
"team_members": {}
}' | \
http POST {{baseUrl}}/v2/team-members/bulk-create \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "team_members": {}\n}' \
--output-document \
- {{baseUrl}}/v2/team-members/bulk-create
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["team_members": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/team-members/bulk-create")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"team_members": {
"idempotency-key-1": {
"team_member": {
"assigned_locations": {
"assignment_type": "EXPLICIT_LOCATIONS",
"location_ids": [
"GA2Y9HSJ8KRYT",
"YSGH2WBKG94QZ"
]
},
"email_address": "joe_doe@gmail.com",
"family_name": "Doe",
"given_name": "Joe",
"id": "ywhG1qfIOoqsHfVRubFV",
"is_owner": false,
"phone_number": "+14159283333",
"reference_id": "reference_id_1",
"status": "ACTIVE"
}
},
"idempotency-key-2": {
"team_member": {
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"email_address": "jane_smith@gmail.com",
"family_name": "Smith",
"given_name": "Jane",
"id": "IF_Ncrg7fHhCqxVI9T6R",
"is_owner": false,
"phone_number": "+14159223334",
"reference_id": "reference_id_2",
"status": "ACTIVE"
}
}
}
}
POST
BulkUpdateTeamMembers
{{baseUrl}}/v2/team-members/bulk-update
BODY json
{
"team_members": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/team-members/bulk-update");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"team_members\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/team-members/bulk-update" {:content-type :json
:form-params {:team_members {}}})
require "http/client"
url = "{{baseUrl}}/v2/team-members/bulk-update"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"team_members\": {}\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/team-members/bulk-update"),
Content = new StringContent("{\n \"team_members\": {}\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/team-members/bulk-update");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"team_members\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/team-members/bulk-update"
payload := strings.NewReader("{\n \"team_members\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/team-members/bulk-update HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 24
{
"team_members": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/team-members/bulk-update")
.setHeader("content-type", "application/json")
.setBody("{\n \"team_members\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/team-members/bulk-update"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"team_members\": {}\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"team_members\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/team-members/bulk-update")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/team-members/bulk-update")
.header("content-type", "application/json")
.body("{\n \"team_members\": {}\n}")
.asString();
const data = JSON.stringify({
team_members: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/team-members/bulk-update');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/bulk-update',
headers: {'content-type': 'application/json'},
data: {team_members: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/team-members/bulk-update';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"team_members":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/team-members/bulk-update',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "team_members": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"team_members\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/team-members/bulk-update")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/team-members/bulk-update',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({team_members: {}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/bulk-update',
headers: {'content-type': 'application/json'},
body: {team_members: {}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/team-members/bulk-update');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
team_members: {}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/bulk-update',
headers: {'content-type': 'application/json'},
data: {team_members: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/team-members/bulk-update';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"team_members":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"team_members": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/team-members/bulk-update"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/team-members/bulk-update" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"team_members\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/team-members/bulk-update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'team_members' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/team-members/bulk-update', [
'body' => '{
"team_members": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/team-members/bulk-update');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'team_members' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'team_members' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/team-members/bulk-update');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/team-members/bulk-update' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"team_members": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/team-members/bulk-update' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"team_members": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"team_members\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/team-members/bulk-update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/team-members/bulk-update"
payload = { "team_members": {} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/team-members/bulk-update"
payload <- "{\n \"team_members\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/team-members/bulk-update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"team_members\": {}\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/team-members/bulk-update') do |req|
req.body = "{\n \"team_members\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/team-members/bulk-update";
let payload = json!({"team_members": json!({})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/team-members/bulk-update \
--header 'content-type: application/json' \
--data '{
"team_members": {}
}'
echo '{
"team_members": {}
}' | \
http POST {{baseUrl}}/v2/team-members/bulk-update \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "team_members": {}\n}' \
--output-document \
- {{baseUrl}}/v2/team-members/bulk-update
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["team_members": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/team-members/bulk-update")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"team_members": {
"AFMwA08kR-MIF-3Vs0OE": {
"team_member": {
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-06-11T22:46:57.001Z",
"email_address": "jane_smith@gmail.com",
"family_name": "Smith",
"given_name": "Jane",
"id": "AFMwA08kR-MIF-3Vs0OE",
"is_owner": false,
"phone_number": "+14159223334",
"reference_id": "reference_id_2",
"status": "ACTIVE"
}
},
"fpgteZNMaf0qOK-a4t6P": {
"team_member": {
"assigned_locations": {
"assignment_type": "EXPLICIT_LOCATIONS",
"location_ids": [
"GA2Y9HSJ8KRYT",
"YSGH2WBKG94QZ"
]
},
"created_at": "2020-06-11T22:46:57.095Z",
"email_address": "joe_doe@gmail.com",
"family_name": "Doe",
"given_name": "Joe",
"id": "fpgteZNMaf0qOK-a4t6P",
"is_owner": false,
"phone_number": "+14159283333",
"reference_id": "reference_id_1",
"status": "ACTIVE"
}
}
}
}
POST
CreateTeamMember
{{baseUrl}}/v2/team-members
BODY json
{
"idempotency_key": "",
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/team-members");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/team-members" {:content-type :json
:form-params {:idempotency_key ""
:team_member {:assigned_locations {:assignment_type ""
:location_ids []}
:created_at ""
:email_address ""
:family_name ""
:given_name ""
:id ""
:is_owner false
:phone_number ""
:reference_id ""
:status ""
:updated_at ""}}})
require "http/client"
url = "{{baseUrl}}/v2/team-members"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/team-members"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/team-members");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/team-members"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/team-members HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 356
{
"idempotency_key": "",
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/team-members")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/team-members"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/team-members")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/team-members")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
team_member: {
assigned_locations: {
assignment_type: '',
location_ids: []
},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/team-members');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
team_member: {
assigned_locations: {assignment_type: '', location_ids: []},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/team-members';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","team_member":{"assigned_locations":{"assignment_type":"","location_ids":[]},"created_at":"","email_address":"","family_name":"","given_name":"","id":"","is_owner":false,"phone_number":"","reference_id":"","status":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/team-members',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "team_member": {\n "assigned_locations": {\n "assignment_type": "",\n "location_ids": []\n },\n "created_at": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "id": "",\n "is_owner": false,\n "phone_number": "",\n "reference_id": "",\n "status": "",\n "updated_at": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/team-members")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/team-members',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
team_member: {
assigned_locations: {assignment_type: '', location_ids: []},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
team_member: {
assigned_locations: {assignment_type: '', location_ids: []},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/team-members');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
team_member: {
assigned_locations: {
assignment_type: '',
location_ids: []
},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
team_member: {
assigned_locations: {assignment_type: '', location_ids: []},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/team-members';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","team_member":{"assigned_locations":{"assignment_type":"","location_ids":[]},"created_at":"","email_address":"","family_name":"","given_name":"","id":"","is_owner":false,"phone_number":"","reference_id":"","status":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"team_member": @{ @"assigned_locations": @{ @"assignment_type": @"", @"location_ids": @[ ] }, @"created_at": @"", @"email_address": @"", @"family_name": @"", @"given_name": @"", @"id": @"", @"is_owner": @NO, @"phone_number": @"", @"reference_id": @"", @"status": @"", @"updated_at": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/team-members"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/team-members" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/team-members",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'team_member' => [
'assigned_locations' => [
'assignment_type' => '',
'location_ids' => [
]
],
'created_at' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'id' => '',
'is_owner' => null,
'phone_number' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/team-members', [
'body' => '{
"idempotency_key": "",
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/team-members');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'team_member' => [
'assigned_locations' => [
'assignment_type' => '',
'location_ids' => [
]
],
'created_at' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'id' => '',
'is_owner' => null,
'phone_number' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'team_member' => [
'assigned_locations' => [
'assignment_type' => '',
'location_ids' => [
]
],
'created_at' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'id' => '',
'is_owner' => null,
'phone_number' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/team-members');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/team-members' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/team-members' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/team-members", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/team-members"
payload = {
"idempotency_key": "",
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": False,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/team-members"
payload <- "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/team-members")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/team-members') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/team-members";
let payload = json!({
"idempotency_key": "",
"team_member": json!({
"assigned_locations": json!({
"assignment_type": "",
"location_ids": ()
}),
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/team-members \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}'
echo '{
"idempotency_key": "",
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}' | \
http POST {{baseUrl}}/v2/team-members \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "team_member": {\n "assigned_locations": {\n "assignment_type": "",\n "location_ids": []\n },\n "created_at": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "id": "",\n "is_owner": false,\n "phone_number": "",\n "reference_id": "",\n "status": "",\n "updated_at": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/team-members
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"team_member": [
"assigned_locations": [
"assignment_type": "",
"location_ids": []
],
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/team-members")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"team_member": {
"assigned_locations": {
"assignment_type": "EXPLICIT_LOCATIONS",
"location_ids": [
"GA2Y9HSJ8KRYT",
"YSGH2WBKG94QZ"
]
},
"email_address": "joe_doe@gmail.com",
"family_name": "Doe",
"given_name": "Joe",
"id": "1yJlHapkseYnNPETIU1B",
"is_owner": false,
"phone_number": "+14159283333",
"reference_id": "reference_id_1",
"status": "ACTIVE"
}
}
GET
RetrieveTeamMember
{{baseUrl}}/v2/team-members/:team_member_id
QUERY PARAMS
team_member_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/team-members/:team_member_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/team-members/:team_member_id")
require "http/client"
url = "{{baseUrl}}/v2/team-members/:team_member_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/team-members/:team_member_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/team-members/:team_member_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/team-members/:team_member_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/team-members/:team_member_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/team-members/:team_member_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/team-members/:team_member_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/team-members/:team_member_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/team-members/:team_member_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/team-members/:team_member_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/team-members/:team_member_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/team-members/:team_member_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/team-members/:team_member_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/team-members/:team_member_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/team-members/:team_member_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/team-members/:team_member_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/team-members/:team_member_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/team-members/:team_member_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/team-members/:team_member_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/team-members/:team_member_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/team-members/:team_member_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/team-members/:team_member_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/team-members/:team_member_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/team-members/:team_member_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/team-members/:team_member_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/team-members/:team_member_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/team-members/:team_member_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/team-members/:team_member_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/team-members/:team_member_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/team-members/:team_member_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/team-members/:team_member_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/team-members/:team_member_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/team-members/:team_member_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/team-members/:team_member_id
http GET {{baseUrl}}/v2/team-members/:team_member_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/team-members/:team_member_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/team-members/:team_member_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"team_member": {
"assigned_locations": {
"assignment_type": "EXPLICIT_LOCATIONS",
"location_ids": [
"GA2Y9HSJ8KRYT",
"YSGH2WBKG94QZ"
]
},
"created_at": "2020-06-11T22:55:45.867Z",
"email_address": "joe_doe@gmail.com",
"family_name": "Doe",
"given_name": "Joe",
"id": "1yJlHapkseYnNPETIU1B",
"is_owner": false,
"phone_number": "+14159283333",
"reference_id": "reference_id_1",
"status": "ACTIVE",
"updated_at": "2020-06-11T22:55:45.867Z"
}
}
GET
RetrieveWageSetting
{{baseUrl}}/v2/team-members/:team_member_id/wage-setting
QUERY PARAMS
team_member_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
require "http/client"
url = "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/team-members/:team_member_id/wage-setting HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/team-members/:team_member_id/wage-setting',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/team-members/:team_member_id/wage-setting",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/team-members/:team_member_id/wage-setting")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/team-members/:team_member_id/wage-setting') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/team-members/:team_member_id/wage-setting
http GET {{baseUrl}}/v2/team-members/:team_member_id/wage-setting
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/team-members/:team_member_id/wage-setting
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"wage_setting": {
"created_at": "2020-06-11T23:01:21+00:00",
"is_overtime_exempt": false,
"job_assignments": [
{
"annual_rate": {
"amount": 4500000,
"currency": "USD"
},
"hourly_rate": {
"amount": 2164,
"currency": "USD"
},
"job_title": "Manager",
"pay_type": "SALARY",
"weekly_hours": 40
}
],
"team_member_id": "1yJlHapkseYnNPETIU1B",
"updated_at": "2020-06-11T23:01:21+00:00",
"version": 1
}
}
POST
SearchTeamMembers
{{baseUrl}}/v2/team-members/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"location_ids": [],
"status": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/team-members/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/team-members/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:filter {:location_ids []
:status ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/team-members/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/team-members/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/team-members/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/team-members/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/team-members/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 117
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"location_ids": [],
"status": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/team-members/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/team-members/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/team-members/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/team-members/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
location_ids: [],
status: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/team-members/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/search',
headers: {'content-type': 'application/json'},
data: {cursor: '', limit: 0, query: {filter: {location_ids: [], status: ''}}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/team-members/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"location_ids":[],"status":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/team-members/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "location_ids": [],\n "status": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/team-members/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/team-members/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({cursor: '', limit: 0, query: {filter: {location_ids: [], status: ''}}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/search',
headers: {'content-type': 'application/json'},
body: {cursor: '', limit: 0, query: {filter: {location_ids: [], status: ''}}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/team-members/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
filter: {
location_ids: [],
status: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/team-members/search',
headers: {'content-type': 'application/json'},
data: {cursor: '', limit: 0, query: {filter: {location_ids: [], status: ''}}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/team-members/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"location_ids":[],"status":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"filter": @{ @"location_ids": @[ ], @"status": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/team-members/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/team-members/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/team-members/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'location_ids' => [
],
'status' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/team-members/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"location_ids": [],
"status": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/team-members/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'location_ids' => [
],
'status' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'location_ids' => [
],
'status' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/team-members/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/team-members/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"location_ids": [],
"status": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/team-members/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"location_ids": [],
"status": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/team-members/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/team-members/search"
payload = {
"cursor": "",
"limit": 0,
"query": { "filter": {
"location_ids": [],
"status": ""
} }
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/team-members/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/team-members/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/team-members/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"location_ids\": [],\n \"status\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/team-members/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({"filter": json!({
"location_ids": (),
"status": ""
})})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/team-members/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"location_ids": [],
"status": ""
}
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"location_ids": [],
"status": ""
}
}
}' | \
http POST {{baseUrl}}/v2/team-members/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "location_ids": [],\n "status": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/team-members/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": ["filter": [
"location_ids": [],
"status": ""
]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/team-members/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"cursor": "N:9UglUjOXQ13-hMFypCft",
"team_members": [
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2019-07-10T17:26:48Z",
"email_address": "johnny_cash@squareup.com",
"family_name": "Cash",
"given_name": "Johnny",
"id": "-3oZQKPKVk6gUXU_V5Qa",
"is_owner": false,
"reference_id": "12345678",
"status": "ACTIVE",
"updated_at": "2020-04-28T21:49:28.957Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T18:14:01.127Z",
"family_name": "Smith",
"given_name": "Lombard",
"id": "1AVJj0DjkzbmbJw5r4KK",
"is_owner": false,
"phone_number": "+14155552671",
"reference_id": "abcded",
"status": "ACTIVE",
"updated_at": "2020-06-09T17:38:05.423Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T01:09:25.010Z",
"family_name": "Sway",
"given_name": "Monica",
"id": "2JCmiJol_KKFs9z2Evim",
"is_owner": false,
"status": "ACTIVE",
"updated_at": "2020-03-24T01:09:25.010Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T01:09:23.464Z",
"family_name": "Ipsum",
"given_name": "Elton",
"id": "4uXcJQSLtbk3F0UQHFNQ",
"is_owner": false,
"status": "ACTIVE",
"updated_at": "2020-03-24T01:09:23.464Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T01:09:23.074Z",
"family_name": "Lo",
"given_name": "Steven",
"id": "5CoUpyrw1YwGWcRd-eDL",
"is_owner": false,
"status": "ACTIVE",
"updated_at": "2020-03-24T01:09:23.074Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T18:14:03.865Z",
"email_address": "patrick_steward@gmail.com",
"family_name": "Steward",
"given_name": "Patrick",
"id": "5MRPTTp8MMBLVSmzrGha",
"is_owner": false,
"phone_number": "+14155552671",
"status": "ACTIVE",
"updated_at": "2020-03-24T18:14:03.865Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T01:09:25.180Z",
"family_name": "Manny",
"given_name": "Ivy",
"id": "7F5ZxsfRnkexhu1PTbfh",
"is_owner": false,
"status": "ACTIVE",
"updated_at": "2020-03-24T01:09:25.180Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T18:14:02.797Z",
"email_address": "john_smith@gmail.com",
"family_name": "Smith",
"given_name": "John",
"id": "808X9HR72yKvVaigQXf4",
"is_owner": false,
"phone_number": "+14155552671",
"status": "ACTIVE",
"updated_at": "2020-03-24T18:14:02.797Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T18:14:00.399Z",
"email_address": "r_wen@gmail.com",
"family_name": "Wen",
"given_name": "Robert",
"id": "9MVDVoY4hazkWKGo_OuZ",
"is_owner": false,
"phone_number": "+14155552671",
"status": "ACTIVE",
"updated_at": "2020-03-24T18:14:00.399Z"
},
{
"assigned_locations": {
"assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
},
"created_at": "2020-03-24T18:14:00.445Z",
"email_address": "asimpson@gmail.com",
"family_name": "Simpson",
"given_name": "Ashley",
"id": "9UglUjOXQ13-hMFypCft",
"is_owner": false,
"phone_number": "+14155552671",
"status": "ACTIVE",
"updated_at": "2020-03-24T18:14:00.445Z"
}
]
}
PUT
UpdateTeamMember
{{baseUrl}}/v2/team-members/:team_member_id
QUERY PARAMS
team_member_id
BODY json
{
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/team-members/:team_member_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/team-members/:team_member_id" {:content-type :json
:form-params {:team_member {:assigned_locations {:assignment_type ""
:location_ids []}
:created_at ""
:email_address ""
:family_name ""
:given_name ""
:id ""
:is_owner false
:phone_number ""
:reference_id ""
:status ""
:updated_at ""}}})
require "http/client"
url = "{{baseUrl}}/v2/team-members/:team_member_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/team-members/:team_member_id"),
Content = new StringContent("{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/team-members/:team_member_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/team-members/:team_member_id"
payload := strings.NewReader("{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/team-members/:team_member_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 331
{
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/team-members/:team_member_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/team-members/:team_member_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/team-members/:team_member_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/team-members/:team_member_id")
.header("content-type", "application/json")
.body("{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
team_member: {
assigned_locations: {
assignment_type: '',
location_ids: []
},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/team-members/:team_member_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/team-members/:team_member_id',
headers: {'content-type': 'application/json'},
data: {
team_member: {
assigned_locations: {assignment_type: '', location_ids: []},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/team-members/:team_member_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"team_member":{"assigned_locations":{"assignment_type":"","location_ids":[]},"created_at":"","email_address":"","family_name":"","given_name":"","id":"","is_owner":false,"phone_number":"","reference_id":"","status":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/team-members/:team_member_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "team_member": {\n "assigned_locations": {\n "assignment_type": "",\n "location_ids": []\n },\n "created_at": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "id": "",\n "is_owner": false,\n "phone_number": "",\n "reference_id": "",\n "status": "",\n "updated_at": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/team-members/:team_member_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/team-members/:team_member_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
team_member: {
assigned_locations: {assignment_type: '', location_ids: []},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/team-members/:team_member_id',
headers: {'content-type': 'application/json'},
body: {
team_member: {
assigned_locations: {assignment_type: '', location_ids: []},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/team-members/:team_member_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
team_member: {
assigned_locations: {
assignment_type: '',
location_ids: []
},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/team-members/:team_member_id',
headers: {'content-type': 'application/json'},
data: {
team_member: {
assigned_locations: {assignment_type: '', location_ids: []},
created_at: '',
email_address: '',
family_name: '',
given_name: '',
id: '',
is_owner: false,
phone_number: '',
reference_id: '',
status: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/team-members/:team_member_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"team_member":{"assigned_locations":{"assignment_type":"","location_ids":[]},"created_at":"","email_address":"","family_name":"","given_name":"","id":"","is_owner":false,"phone_number":"","reference_id":"","status":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"team_member": @{ @"assigned_locations": @{ @"assignment_type": @"", @"location_ids": @[ ] }, @"created_at": @"", @"email_address": @"", @"family_name": @"", @"given_name": @"", @"id": @"", @"is_owner": @NO, @"phone_number": @"", @"reference_id": @"", @"status": @"", @"updated_at": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/team-members/:team_member_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/team-members/:team_member_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/team-members/:team_member_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'team_member' => [
'assigned_locations' => [
'assignment_type' => '',
'location_ids' => [
]
],
'created_at' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'id' => '',
'is_owner' => null,
'phone_number' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/team-members/:team_member_id', [
'body' => '{
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/team-members/:team_member_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'team_member' => [
'assigned_locations' => [
'assignment_type' => '',
'location_ids' => [
]
],
'created_at' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'id' => '',
'is_owner' => null,
'phone_number' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'team_member' => [
'assigned_locations' => [
'assignment_type' => '',
'location_ids' => [
]
],
'created_at' => '',
'email_address' => '',
'family_name' => '',
'given_name' => '',
'id' => '',
'is_owner' => null,
'phone_number' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/team-members/:team_member_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/team-members/:team_member_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/team-members/:team_member_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/team-members/:team_member_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/team-members/:team_member_id"
payload = { "team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": False,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/team-members/:team_member_id"
payload <- "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/team-members/:team_member_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/team-members/:team_member_id') do |req|
req.body = "{\n \"team_member\": {\n \"assigned_locations\": {\n \"assignment_type\": \"\",\n \"location_ids\": []\n },\n \"created_at\": \"\",\n \"email_address\": \"\",\n \"family_name\": \"\",\n \"given_name\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"phone_number\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/team-members/:team_member_id";
let payload = json!({"team_member": json!({
"assigned_locations": json!({
"assignment_type": "",
"location_ids": ()
}),
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/team-members/:team_member_id \
--header 'content-type: application/json' \
--data '{
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}'
echo '{
"team_member": {
"assigned_locations": {
"assignment_type": "",
"location_ids": []
},
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
}
}' | \
http PUT {{baseUrl}}/v2/team-members/:team_member_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "team_member": {\n "assigned_locations": {\n "assignment_type": "",\n "location_ids": []\n },\n "created_at": "",\n "email_address": "",\n "family_name": "",\n "given_name": "",\n "id": "",\n "is_owner": false,\n "phone_number": "",\n "reference_id": "",\n "status": "",\n "updated_at": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/team-members/:team_member_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["team_member": [
"assigned_locations": [
"assignment_type": "",
"location_ids": []
],
"created_at": "",
"email_address": "",
"family_name": "",
"given_name": "",
"id": "",
"is_owner": false,
"phone_number": "",
"reference_id": "",
"status": "",
"updated_at": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/team-members/:team_member_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"team_member": {
"assigned_locations": {
"assignment_type": "EXPLICIT_LOCATIONS",
"location_ids": [
"GA2Y9HSJ8KRYT",
"YSGH2WBKG94QZ"
]
},
"created_at": "2020-06-11T22:55:45.867Z",
"email_address": "joe_doe@gmail.com",
"family_name": "Doe",
"given_name": "Joe",
"id": "1yJlHapkseYnNPETIU1B",
"is_owner": false,
"phone_number": "+14159283333",
"reference_id": "reference_id_1",
"status": "ACTIVE"
}
}
PUT
UpdateWageSetting
{{baseUrl}}/v2/team-members/:team_member_id/wage-setting
QUERY PARAMS
team_member_id
BODY json
{
"wage_setting": {
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": [
{
"annual_rate": {
"amount": 0,
"currency": ""
},
"hourly_rate": {},
"job_title": "",
"pay_type": "",
"weekly_hours": 0
}
],
"team_member_id": "",
"updated_at": "",
"version": 0
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting" {:content-type :json
:form-params {:wage_setting {:created_at ""
:is_overtime_exempt false
:job_assignments [{:annual_rate {:amount 0
:currency ""}
:hourly_rate {}
:job_title ""
:pay_type ""
:weekly_hours 0}]
:team_member_id ""
:updated_at ""
:version 0}}})
require "http/client"
url = "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"),
Content = new StringContent("{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"
payload := strings.NewReader("{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v2/team-members/:team_member_id/wage-setting HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 381
{
"wage_setting": {
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": [
{
"annual_rate": {
"amount": 0,
"currency": ""
},
"hourly_rate": {},
"job_title": "",
"pay_type": "",
"weekly_hours": 0
}
],
"team_member_id": "",
"updated_at": "",
"version": 0
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
.setHeader("content-type", "application/json")
.setBody("{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
.header("content-type", "application/json")
.body("{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
.asString();
const data = JSON.stringify({
wage_setting: {
created_at: '',
is_overtime_exempt: false,
job_assignments: [
{
annual_rate: {
amount: 0,
currency: ''
},
hourly_rate: {},
job_title: '',
pay_type: '',
weekly_hours: 0
}
],
team_member_id: '',
updated_at: '',
version: 0
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting',
headers: {'content-type': 'application/json'},
data: {
wage_setting: {
created_at: '',
is_overtime_exempt: false,
job_assignments: [
{
annual_rate: {amount: 0, currency: ''},
hourly_rate: {},
job_title: '',
pay_type: '',
weekly_hours: 0
}
],
team_member_id: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"wage_setting":{"created_at":"","is_overtime_exempt":false,"job_assignments":[{"annual_rate":{"amount":0,"currency":""},"hourly_rate":{},"job_title":"","pay_type":"","weekly_hours":0}],"team_member_id":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "wage_setting": {\n "created_at": "",\n "is_overtime_exempt": false,\n "job_assignments": [\n {\n "annual_rate": {\n "amount": 0,\n "currency": ""\n },\n "hourly_rate": {},\n "job_title": "",\n "pay_type": "",\n "weekly_hours": 0\n }\n ],\n "team_member_id": "",\n "updated_at": "",\n "version": 0\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/team-members/:team_member_id/wage-setting',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
wage_setting: {
created_at: '',
is_overtime_exempt: false,
job_assignments: [
{
annual_rate: {amount: 0, currency: ''},
hourly_rate: {},
job_title: '',
pay_type: '',
weekly_hours: 0
}
],
team_member_id: '',
updated_at: '',
version: 0
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting',
headers: {'content-type': 'application/json'},
body: {
wage_setting: {
created_at: '',
is_overtime_exempt: false,
job_assignments: [
{
annual_rate: {amount: 0, currency: ''},
hourly_rate: {},
job_title: '',
pay_type: '',
weekly_hours: 0
}
],
team_member_id: '',
updated_at: '',
version: 0
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
wage_setting: {
created_at: '',
is_overtime_exempt: false,
job_assignments: [
{
annual_rate: {
amount: 0,
currency: ''
},
hourly_rate: {},
job_title: '',
pay_type: '',
weekly_hours: 0
}
],
team_member_id: '',
updated_at: '',
version: 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting',
headers: {'content-type': 'application/json'},
data: {
wage_setting: {
created_at: '',
is_overtime_exempt: false,
job_assignments: [
{
annual_rate: {amount: 0, currency: ''},
hourly_rate: {},
job_title: '',
pay_type: '',
weekly_hours: 0
}
],
team_member_id: '',
updated_at: '',
version: 0
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"wage_setting":{"created_at":"","is_overtime_exempt":false,"job_assignments":[{"annual_rate":{"amount":0,"currency":""},"hourly_rate":{},"job_title":"","pay_type":"","weekly_hours":0}],"team_member_id":"","updated_at":"","version":0}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"wage_setting": @{ @"created_at": @"", @"is_overtime_exempt": @NO, @"job_assignments": @[ @{ @"annual_rate": @{ @"amount": @0, @"currency": @"" }, @"hourly_rate": @{ }, @"job_title": @"", @"pay_type": @"", @"weekly_hours": @0 } ], @"team_member_id": @"", @"updated_at": @"", @"version": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/team-members/:team_member_id/wage-setting",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'wage_setting' => [
'created_at' => '',
'is_overtime_exempt' => null,
'job_assignments' => [
[
'annual_rate' => [
'amount' => 0,
'currency' => ''
],
'hourly_rate' => [
],
'job_title' => '',
'pay_type' => '',
'weekly_hours' => 0
]
],
'team_member_id' => '',
'updated_at' => '',
'version' => 0
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting', [
'body' => '{
"wage_setting": {
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": [
{
"annual_rate": {
"amount": 0,
"currency": ""
},
"hourly_rate": {},
"job_title": "",
"pay_type": "",
"weekly_hours": 0
}
],
"team_member_id": "",
"updated_at": "",
"version": 0
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'wage_setting' => [
'created_at' => '',
'is_overtime_exempt' => null,
'job_assignments' => [
[
'annual_rate' => [
'amount' => 0,
'currency' => ''
],
'hourly_rate' => [
],
'job_title' => '',
'pay_type' => '',
'weekly_hours' => 0
]
],
'team_member_id' => '',
'updated_at' => '',
'version' => 0
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'wage_setting' => [
'created_at' => '',
'is_overtime_exempt' => null,
'job_assignments' => [
[
'annual_rate' => [
'amount' => 0,
'currency' => ''
],
'hourly_rate' => [
],
'job_title' => '',
'pay_type' => '',
'weekly_hours' => 0
]
],
'team_member_id' => '',
'updated_at' => '',
'version' => 0
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/team-members/:team_member_id/wage-setting');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"wage_setting": {
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": [
{
"annual_rate": {
"amount": 0,
"currency": ""
},
"hourly_rate": {},
"job_title": "",
"pay_type": "",
"weekly_hours": 0
}
],
"team_member_id": "",
"updated_at": "",
"version": 0
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/team-members/:team_member_id/wage-setting' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"wage_setting": {
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": [
{
"annual_rate": {
"amount": 0,
"currency": ""
},
"hourly_rate": {},
"job_title": "",
"pay_type": "",
"weekly_hours": 0
}
],
"team_member_id": "",
"updated_at": "",
"version": 0
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v2/team-members/:team_member_id/wage-setting", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"
payload = { "wage_setting": {
"created_at": "",
"is_overtime_exempt": False,
"job_assignments": [
{
"annual_rate": {
"amount": 0,
"currency": ""
},
"hourly_rate": {},
"job_title": "",
"pay_type": "",
"weekly_hours": 0
}
],
"team_member_id": "",
"updated_at": "",
"version": 0
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting"
payload <- "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v2/team-members/:team_member_id/wage-setting') do |req|
req.body = "{\n \"wage_setting\": {\n \"created_at\": \"\",\n \"is_overtime_exempt\": false,\n \"job_assignments\": [\n {\n \"annual_rate\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"hourly_rate\": {},\n \"job_title\": \"\",\n \"pay_type\": \"\",\n \"weekly_hours\": 0\n }\n ],\n \"team_member_id\": \"\",\n \"updated_at\": \"\",\n \"version\": 0\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting";
let payload = json!({"wage_setting": json!({
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": (
json!({
"annual_rate": json!({
"amount": 0,
"currency": ""
}),
"hourly_rate": json!({}),
"job_title": "",
"pay_type": "",
"weekly_hours": 0
})
),
"team_member_id": "",
"updated_at": "",
"version": 0
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v2/team-members/:team_member_id/wage-setting \
--header 'content-type: application/json' \
--data '{
"wage_setting": {
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": [
{
"annual_rate": {
"amount": 0,
"currency": ""
},
"hourly_rate": {},
"job_title": "",
"pay_type": "",
"weekly_hours": 0
}
],
"team_member_id": "",
"updated_at": "",
"version": 0
}
}'
echo '{
"wage_setting": {
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": [
{
"annual_rate": {
"amount": 0,
"currency": ""
},
"hourly_rate": {},
"job_title": "",
"pay_type": "",
"weekly_hours": 0
}
],
"team_member_id": "",
"updated_at": "",
"version": 0
}
}' | \
http PUT {{baseUrl}}/v2/team-members/:team_member_id/wage-setting \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "wage_setting": {\n "created_at": "",\n "is_overtime_exempt": false,\n "job_assignments": [\n {\n "annual_rate": {\n "amount": 0,\n "currency": ""\n },\n "hourly_rate": {},\n "job_title": "",\n "pay_type": "",\n "weekly_hours": 0\n }\n ],\n "team_member_id": "",\n "updated_at": "",\n "version": 0\n }\n}' \
--output-document \
- {{baseUrl}}/v2/team-members/:team_member_id/wage-setting
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["wage_setting": [
"created_at": "",
"is_overtime_exempt": false,
"job_assignments": [
[
"annual_rate": [
"amount": 0,
"currency": ""
],
"hourly_rate": [],
"job_title": "",
"pay_type": "",
"weekly_hours": 0
]
],
"team_member_id": "",
"updated_at": "",
"version": 0
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/team-members/:team_member_id/wage-setting")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"wage_setting": {
"created_at": "2019-07-10T17:26:48+00:00",
"is_overtime_exempt": true,
"job_assignments": [
{
"annual_rate": {
"amount": 3000000,
"currency": "USD"
},
"hourly_rate": {
"amount": 1443,
"currency": "USD"
},
"job_title": "Manager",
"pay_type": "SALARY",
"weekly_hours": 40
},
{
"hourly_rate": {
"amount": 1200,
"currency": "USD"
},
"job_title": "Cashier",
"pay_type": "HOURLY"
}
],
"team_member_id": "-3oZQKPKVk6gUXU_V5Qa",
"updated_at": "2020-06-11T23:12:04+00:00",
"version": 1
}
}
POST
CancelTerminalCheckout
{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel
QUERY PARAMS
checkout_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel")
require "http/client"
url = "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/terminals/checkouts/:checkout_id/cancel HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/terminals/checkouts/:checkout_id/cancel',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/terminals/checkouts/:checkout_id/cancel")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/terminals/checkouts/:checkout_id/cancel') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel
http POST {{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/terminals/checkouts/:checkout_id/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"checkout": {
"amount_money": {
"amount": 123,
"currency": "USD"
},
"app_id": "APP_ID",
"cancel_reason": "SELLER_CANCELED",
"created_at": "2020-03-16T15:31:19.934Z",
"deadline_duration": "PT10M",
"device_options": {
"device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003",
"skip_receipt_screen": true,
"tip_settings": {
"allow_tipping": true
}
},
"id": "S1yDlPQx7slqO",
"reference_id": "id36815",
"status": "CANCELED",
"updated_at": "2020-03-16T15:31:45.787Z"
}
}
POST
CancelTerminalRefund
{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel
QUERY PARAMS
terminal_refund_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel")
require "http/client"
url = "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/terminals/refunds/:terminal_refund_id/cancel HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/terminals/refunds/:terminal_refund_id/cancel',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/terminals/refunds/:terminal_refund_id/cancel")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/terminals/refunds/:terminal_refund_id/cancel') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel
http POST {{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"refund": {
"amount_money": {
"amount": 100,
"currency": "CAD"
},
"app_id": "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ",
"cancel_reason": "SELLER_CANCELED",
"card": {
"bin": "411111",
"card_brand": "INTERAC",
"card_type": "CREDIT",
"exp_month": 1,
"exp_year": 2022,
"fingerprint": "sq-1-B1fP9MNNmZgVVaPKRND6oDKYbz25S2cTvg9Mzwg3RMTK1zT1PiGRT-AE3nTA8vSmmw",
"last_4": "1111"
},
"created_at": "2020-10-21T22:47:23.241Z",
"deadline_duration": "PT5M",
"device_id": "42690809-faa2-4701-a24b-19d3d34c9aaa",
"id": "g6ycb6HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY",
"location_id": "76C9W6K8CNNQ5",
"order_id": "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY",
"payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY",
"reason": "reason",
"status": "CANCELED",
"updated_at": "2020-10-21T22:47:30.096Z"
}
}
POST
CreateTerminalCheckout
{{baseUrl}}/v2/terminals/checkouts
BODY json
{
"checkout": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": {
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": []
}
},
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
},
"idempotency_key": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/terminals/checkouts");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/terminals/checkouts" {:content-type :json
:form-params {:checkout {:amount_money {:amount 0
:currency ""}
:app_id ""
:cancel_reason ""
:created_at ""
:deadline_duration ""
:device_options {:device_id ""
:skip_receipt_screen false
:tip_settings {:allow_tipping false
:custom_tip_field false
:separate_tip_screen false
:smart_tipping false
:tip_percentages []}}
:id ""
:location_id ""
:note ""
:payment_ids []
:payment_type ""
:reference_id ""
:status ""
:updated_at ""}
:idempotency_key ""}})
require "http/client"
url = "{{baseUrl}}/v2/terminals/checkouts"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/terminals/checkouts"),
Content = new StringContent("{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/terminals/checkouts");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/terminals/checkouts"
payload := strings.NewReader("{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/terminals/checkouts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 663
{
"checkout": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": {
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": []
}
},
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
},
"idempotency_key": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/terminals/checkouts")
.setHeader("content-type", "application/json")
.setBody("{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/terminals/checkouts"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/terminals/checkouts")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/terminals/checkouts")
.header("content-type", "application/json")
.body("{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
.asString();
const data = JSON.stringify({
checkout: {
amount_money: {
amount: 0,
currency: ''
},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_options: {
device_id: '',
skip_receipt_screen: false,
tip_settings: {
allow_tipping: false,
custom_tip_field: false,
separate_tip_screen: false,
smart_tipping: false,
tip_percentages: []
}
},
id: '',
location_id: '',
note: '',
payment_ids: [],
payment_type: '',
reference_id: '',
status: '',
updated_at: ''
},
idempotency_key: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/terminals/checkouts');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts',
headers: {'content-type': 'application/json'},
data: {
checkout: {
amount_money: {amount: 0, currency: ''},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_options: {
device_id: '',
skip_receipt_screen: false,
tip_settings: {
allow_tipping: false,
custom_tip_field: false,
separate_tip_screen: false,
smart_tipping: false,
tip_percentages: []
}
},
id: '',
location_id: '',
note: '',
payment_ids: [],
payment_type: '',
reference_id: '',
status: '',
updated_at: ''
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/terminals/checkouts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"checkout":{"amount_money":{"amount":0,"currency":""},"app_id":"","cancel_reason":"","created_at":"","deadline_duration":"","device_options":{"device_id":"","skip_receipt_screen":false,"tip_settings":{"allow_tipping":false,"custom_tip_field":false,"separate_tip_screen":false,"smart_tipping":false,"tip_percentages":[]}},"id":"","location_id":"","note":"","payment_ids":[],"payment_type":"","reference_id":"","status":"","updated_at":""},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/terminals/checkouts',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "checkout": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_id": "",\n "cancel_reason": "",\n "created_at": "",\n "deadline_duration": "",\n "device_options": {\n "device_id": "",\n "skip_receipt_screen": false,\n "tip_settings": {\n "allow_tipping": false,\n "custom_tip_field": false,\n "separate_tip_screen": false,\n "smart_tipping": false,\n "tip_percentages": []\n }\n },\n "id": "",\n "location_id": "",\n "note": "",\n "payment_ids": [],\n "payment_type": "",\n "reference_id": "",\n "status": "",\n "updated_at": ""\n },\n "idempotency_key": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/terminals/checkouts")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/terminals/checkouts',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
checkout: {
amount_money: {amount: 0, currency: ''},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_options: {
device_id: '',
skip_receipt_screen: false,
tip_settings: {
allow_tipping: false,
custom_tip_field: false,
separate_tip_screen: false,
smart_tipping: false,
tip_percentages: []
}
},
id: '',
location_id: '',
note: '',
payment_ids: [],
payment_type: '',
reference_id: '',
status: '',
updated_at: ''
},
idempotency_key: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts',
headers: {'content-type': 'application/json'},
body: {
checkout: {
amount_money: {amount: 0, currency: ''},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_options: {
device_id: '',
skip_receipt_screen: false,
tip_settings: {
allow_tipping: false,
custom_tip_field: false,
separate_tip_screen: false,
smart_tipping: false,
tip_percentages: []
}
},
id: '',
location_id: '',
note: '',
payment_ids: [],
payment_type: '',
reference_id: '',
status: '',
updated_at: ''
},
idempotency_key: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/terminals/checkouts');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
checkout: {
amount_money: {
amount: 0,
currency: ''
},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_options: {
device_id: '',
skip_receipt_screen: false,
tip_settings: {
allow_tipping: false,
custom_tip_field: false,
separate_tip_screen: false,
smart_tipping: false,
tip_percentages: []
}
},
id: '',
location_id: '',
note: '',
payment_ids: [],
payment_type: '',
reference_id: '',
status: '',
updated_at: ''
},
idempotency_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts',
headers: {'content-type': 'application/json'},
data: {
checkout: {
amount_money: {amount: 0, currency: ''},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_options: {
device_id: '',
skip_receipt_screen: false,
tip_settings: {
allow_tipping: false,
custom_tip_field: false,
separate_tip_screen: false,
smart_tipping: false,
tip_percentages: []
}
},
id: '',
location_id: '',
note: '',
payment_ids: [],
payment_type: '',
reference_id: '',
status: '',
updated_at: ''
},
idempotency_key: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/terminals/checkouts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"checkout":{"amount_money":{"amount":0,"currency":""},"app_id":"","cancel_reason":"","created_at":"","deadline_duration":"","device_options":{"device_id":"","skip_receipt_screen":false,"tip_settings":{"allow_tipping":false,"custom_tip_field":false,"separate_tip_screen":false,"smart_tipping":false,"tip_percentages":[]}},"id":"","location_id":"","note":"","payment_ids":[],"payment_type":"","reference_id":"","status":"","updated_at":""},"idempotency_key":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"checkout": @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"app_id": @"", @"cancel_reason": @"", @"created_at": @"", @"deadline_duration": @"", @"device_options": @{ @"device_id": @"", @"skip_receipt_screen": @NO, @"tip_settings": @{ @"allow_tipping": @NO, @"custom_tip_field": @NO, @"separate_tip_screen": @NO, @"smart_tipping": @NO, @"tip_percentages": @[ ] } }, @"id": @"", @"location_id": @"", @"note": @"", @"payment_ids": @[ ], @"payment_type": @"", @"reference_id": @"", @"status": @"", @"updated_at": @"" },
@"idempotency_key": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/terminals/checkouts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/terminals/checkouts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/terminals/checkouts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'checkout' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_id' => '',
'cancel_reason' => '',
'created_at' => '',
'deadline_duration' => '',
'device_options' => [
'device_id' => '',
'skip_receipt_screen' => null,
'tip_settings' => [
'allow_tipping' => null,
'custom_tip_field' => null,
'separate_tip_screen' => null,
'smart_tipping' => null,
'tip_percentages' => [
]
]
],
'id' => '',
'location_id' => '',
'note' => '',
'payment_ids' => [
],
'payment_type' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
],
'idempotency_key' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/terminals/checkouts', [
'body' => '{
"checkout": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": {
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": []
}
},
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
},
"idempotency_key": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/terminals/checkouts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'checkout' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_id' => '',
'cancel_reason' => '',
'created_at' => '',
'deadline_duration' => '',
'device_options' => [
'device_id' => '',
'skip_receipt_screen' => null,
'tip_settings' => [
'allow_tipping' => null,
'custom_tip_field' => null,
'separate_tip_screen' => null,
'smart_tipping' => null,
'tip_percentages' => [
]
]
],
'id' => '',
'location_id' => '',
'note' => '',
'payment_ids' => [
],
'payment_type' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
],
'idempotency_key' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'checkout' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_id' => '',
'cancel_reason' => '',
'created_at' => '',
'deadline_duration' => '',
'device_options' => [
'device_id' => '',
'skip_receipt_screen' => null,
'tip_settings' => [
'allow_tipping' => null,
'custom_tip_field' => null,
'separate_tip_screen' => null,
'smart_tipping' => null,
'tip_percentages' => [
]
]
],
'id' => '',
'location_id' => '',
'note' => '',
'payment_ids' => [
],
'payment_type' => '',
'reference_id' => '',
'status' => '',
'updated_at' => ''
],
'idempotency_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/terminals/checkouts');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/terminals/checkouts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"checkout": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": {
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": []
}
},
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
},
"idempotency_key": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/terminals/checkouts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"checkout": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": {
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": []
}
},
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
},
"idempotency_key": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/terminals/checkouts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/terminals/checkouts"
payload = {
"checkout": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": {
"device_id": "",
"skip_receipt_screen": False,
"tip_settings": {
"allow_tipping": False,
"custom_tip_field": False,
"separate_tip_screen": False,
"smart_tipping": False,
"tip_percentages": []
}
},
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
},
"idempotency_key": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/terminals/checkouts"
payload <- "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/terminals/checkouts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/terminals/checkouts') do |req|
req.body = "{\n \"checkout\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_options\": {\n \"device_id\": \"\",\n \"skip_receipt_screen\": false,\n \"tip_settings\": {\n \"allow_tipping\": false,\n \"custom_tip_field\": false,\n \"separate_tip_screen\": false,\n \"smart_tipping\": false,\n \"tip_percentages\": []\n }\n },\n \"id\": \"\",\n \"location_id\": \"\",\n \"note\": \"\",\n \"payment_ids\": [],\n \"payment_type\": \"\",\n \"reference_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n },\n \"idempotency_key\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/terminals/checkouts";
let payload = json!({
"checkout": json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": json!({
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": json!({
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": ()
})
}),
"id": "",
"location_id": "",
"note": "",
"payment_ids": (),
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
}),
"idempotency_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/terminals/checkouts \
--header 'content-type: application/json' \
--data '{
"checkout": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": {
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": []
}
},
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
},
"idempotency_key": ""
}'
echo '{
"checkout": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": {
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": []
}
},
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
},
"idempotency_key": ""
}' | \
http POST {{baseUrl}}/v2/terminals/checkouts \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "checkout": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_id": "",\n "cancel_reason": "",\n "created_at": "",\n "deadline_duration": "",\n "device_options": {\n "device_id": "",\n "skip_receipt_screen": false,\n "tip_settings": {\n "allow_tipping": false,\n "custom_tip_field": false,\n "separate_tip_screen": false,\n "smart_tipping": false,\n "tip_percentages": []\n }\n },\n "id": "",\n "location_id": "",\n "note": "",\n "payment_ids": [],\n "payment_type": "",\n "reference_id": "",\n "status": "",\n "updated_at": ""\n },\n "idempotency_key": ""\n}' \
--output-document \
- {{baseUrl}}/v2/terminals/checkouts
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"checkout": [
"amount_money": [
"amount": 0,
"currency": ""
],
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_options": [
"device_id": "",
"skip_receipt_screen": false,
"tip_settings": [
"allow_tipping": false,
"custom_tip_field": false,
"separate_tip_screen": false,
"smart_tipping": false,
"tip_percentages": []
]
],
"id": "",
"location_id": "",
"note": "",
"payment_ids": [],
"payment_type": "",
"reference_id": "",
"status": "",
"updated_at": ""
],
"idempotency_key": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/terminals/checkouts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"checkout": {
"amount_money": {
"amount": 2610,
"currency": "USD"
},
"app_id": "APP_ID",
"created_at": "2020-04-06T16:39:32.545Z",
"deadline_duration": "PT10M",
"device_options": {
"device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false
}
},
"id": "08YceKh7B3ZqO",
"note": "A brief note",
"payment_type": "CARD_PRESENT",
"reference_id": "id11572",
"status": "PENDING",
"updated_at": "2020-04-06T16:39:32.545Z"
}
}
POST
CreateTerminalRefund
{{baseUrl}}/v2/terminals/refunds
BODY json
{
"idempotency_key": "",
"refund": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/terminals/refunds");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/terminals/refunds" {:content-type :json
:form-params {:idempotency_key ""
:refund {:amount_money {:amount 0
:currency ""}
:app_id ""
:cancel_reason ""
:created_at ""
:deadline_duration ""
:device_id ""
:id ""
:location_id ""
:order_id ""
:payment_id ""
:reason ""
:refund_id ""
:status ""
:updated_at ""}}})
require "http/client"
url = "{{baseUrl}}/v2/terminals/refunds"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/terminals/refunds"),
Content = new StringContent("{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/terminals/refunds");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/terminals/refunds"
payload := strings.NewReader("{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/terminals/refunds HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 387
{
"idempotency_key": "",
"refund": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/terminals/refunds")
.setHeader("content-type", "application/json")
.setBody("{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/terminals/refunds"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/terminals/refunds")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/terminals/refunds")
.header("content-type", "application/json")
.body("{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
idempotency_key: '',
refund: {
amount_money: {
amount: 0,
currency: ''
},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_id: '',
id: '',
location_id: '',
order_id: '',
payment_id: '',
reason: '',
refund_id: '',
status: '',
updated_at: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/terminals/refunds');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
refund: {
amount_money: {amount: 0, currency: ''},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_id: '',
id: '',
location_id: '',
order_id: '',
payment_id: '',
reason: '',
refund_id: '',
status: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/terminals/refunds';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","refund":{"amount_money":{"amount":0,"currency":""},"app_id":"","cancel_reason":"","created_at":"","deadline_duration":"","device_id":"","id":"","location_id":"","order_id":"","payment_id":"","reason":"","refund_id":"","status":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/terminals/refunds',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "idempotency_key": "",\n "refund": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_id": "",\n "cancel_reason": "",\n "created_at": "",\n "deadline_duration": "",\n "device_id": "",\n "id": "",\n "location_id": "",\n "order_id": "",\n "payment_id": "",\n "reason": "",\n "refund_id": "",\n "status": "",\n "updated_at": ""\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/terminals/refunds")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/terminals/refunds',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
idempotency_key: '',
refund: {
amount_money: {amount: 0, currency: ''},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_id: '',
id: '',
location_id: '',
order_id: '',
payment_id: '',
reason: '',
refund_id: '',
status: '',
updated_at: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds',
headers: {'content-type': 'application/json'},
body: {
idempotency_key: '',
refund: {
amount_money: {amount: 0, currency: ''},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_id: '',
id: '',
location_id: '',
order_id: '',
payment_id: '',
reason: '',
refund_id: '',
status: '',
updated_at: ''
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/terminals/refunds');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
idempotency_key: '',
refund: {
amount_money: {
amount: 0,
currency: ''
},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_id: '',
id: '',
location_id: '',
order_id: '',
payment_id: '',
reason: '',
refund_id: '',
status: '',
updated_at: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds',
headers: {'content-type': 'application/json'},
data: {
idempotency_key: '',
refund: {
amount_money: {amount: 0, currency: ''},
app_id: '',
cancel_reason: '',
created_at: '',
deadline_duration: '',
device_id: '',
id: '',
location_id: '',
order_id: '',
payment_id: '',
reason: '',
refund_id: '',
status: '',
updated_at: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/terminals/refunds';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"idempotency_key":"","refund":{"amount_money":{"amount":0,"currency":""},"app_id":"","cancel_reason":"","created_at":"","deadline_duration":"","device_id":"","id":"","location_id":"","order_id":"","payment_id":"","reason":"","refund_id":"","status":"","updated_at":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"idempotency_key": @"",
@"refund": @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"app_id": @"", @"cancel_reason": @"", @"created_at": @"", @"deadline_duration": @"", @"device_id": @"", @"id": @"", @"location_id": @"", @"order_id": @"", @"payment_id": @"", @"reason": @"", @"refund_id": @"", @"status": @"", @"updated_at": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/terminals/refunds"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/terminals/refunds" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/terminals/refunds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '',
'refund' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_id' => '',
'cancel_reason' => '',
'created_at' => '',
'deadline_duration' => '',
'device_id' => '',
'id' => '',
'location_id' => '',
'order_id' => '',
'payment_id' => '',
'reason' => '',
'refund_id' => '',
'status' => '',
'updated_at' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/terminals/refunds', [
'body' => '{
"idempotency_key": "",
"refund": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/terminals/refunds');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'idempotency_key' => '',
'refund' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_id' => '',
'cancel_reason' => '',
'created_at' => '',
'deadline_duration' => '',
'device_id' => '',
'id' => '',
'location_id' => '',
'order_id' => '',
'payment_id' => '',
'reason' => '',
'refund_id' => '',
'status' => '',
'updated_at' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'idempotency_key' => '',
'refund' => [
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'app_id' => '',
'cancel_reason' => '',
'created_at' => '',
'deadline_duration' => '',
'device_id' => '',
'id' => '',
'location_id' => '',
'order_id' => '',
'payment_id' => '',
'reason' => '',
'refund_id' => '',
'status' => '',
'updated_at' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/terminals/refunds');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/terminals/refunds' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"refund": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/terminals/refunds' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"idempotency_key": "",
"refund": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/terminals/refunds", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/terminals/refunds"
payload = {
"idempotency_key": "",
"refund": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/terminals/refunds"
payload <- "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/terminals/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/terminals/refunds') do |req|
req.body = "{\n \"idempotency_key\": \"\",\n \"refund\": {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"app_id\": \"\",\n \"cancel_reason\": \"\",\n \"created_at\": \"\",\n \"deadline_duration\": \"\",\n \"device_id\": \"\",\n \"id\": \"\",\n \"location_id\": \"\",\n \"order_id\": \"\",\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refund_id\": \"\",\n \"status\": \"\",\n \"updated_at\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/terminals/refunds";
let payload = json!({
"idempotency_key": "",
"refund": json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/terminals/refunds \
--header 'content-type: application/json' \
--data '{
"idempotency_key": "",
"refund": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
}
}'
echo '{
"idempotency_key": "",
"refund": {
"amount_money": {
"amount": 0,
"currency": ""
},
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
}
}' | \
http POST {{baseUrl}}/v2/terminals/refunds \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "idempotency_key": "",\n "refund": {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "app_id": "",\n "cancel_reason": "",\n "created_at": "",\n "deadline_duration": "",\n "device_id": "",\n "id": "",\n "location_id": "",\n "order_id": "",\n "payment_id": "",\n "reason": "",\n "refund_id": "",\n "status": "",\n "updated_at": ""\n }\n}' \
--output-document \
- {{baseUrl}}/v2/terminals/refunds
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"idempotency_key": "",
"refund": [
"amount_money": [
"amount": 0,
"currency": ""
],
"app_id": "",
"cancel_reason": "",
"created_at": "",
"deadline_duration": "",
"device_id": "",
"id": "",
"location_id": "",
"order_id": "",
"payment_id": "",
"reason": "",
"refund_id": "",
"status": "",
"updated_at": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/terminals/refunds")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"refund": {
"amount_money": {
"amount": 111,
"currency": "CAD"
},
"app_id": "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ",
"card": {
"bin": "411111",
"card_brand": "INTERAC",
"card_type": "CREDIT",
"exp_month": 1,
"exp_year": 2022,
"fingerprint": "sq-1-B1fP9MNNmZgVVaPKRND6oDKYbz25S2cTvg9Mzwg3RMTK1zT1PiGRT-AE3nTA8vSmmw",
"last_4": "1111"
},
"created_at": "2020-09-29T15:21:46.771Z",
"deadline_duration": "PT5M",
"device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291",
"id": "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY",
"location_id": "76C9W6K8CNNQ5",
"order_id": "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY",
"payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY",
"reason": "Returning items",
"status": "PENDING",
"updated_at": "2020-09-29T15:21:46.771Z"
}
}
GET
GetTerminalCheckout
{{baseUrl}}/v2/terminals/checkouts/:checkout_id
QUERY PARAMS
checkout_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/terminals/checkouts/:checkout_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/terminals/checkouts/:checkout_id")
require "http/client"
url = "{{baseUrl}}/v2/terminals/checkouts/:checkout_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/terminals/checkouts/:checkout_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/terminals/checkouts/:checkout_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/terminals/checkouts/:checkout_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/terminals/checkouts/:checkout_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/terminals/checkouts/:checkout_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/terminals/checkouts/:checkout_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/terminals/checkouts/:checkout_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/terminals/checkouts/:checkout_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/terminals/checkouts/:checkout_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/terminals/checkouts/:checkout_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/terminals/checkouts/:checkout_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/terminals/checkouts/:checkout_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/terminals/checkouts/:checkout_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/terminals/checkouts/:checkout_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/terminals/checkouts/:checkout_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/terminals/checkouts/:checkout_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/terminals/checkouts/:checkout_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/terminals/checkouts/:checkout_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/terminals/checkouts/:checkout_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/terminals/checkouts/:checkout_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/terminals/checkouts/:checkout_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/terminals/checkouts/:checkout_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/terminals/checkouts/:checkout_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/terminals/checkouts/:checkout_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/terminals/checkouts/:checkout_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/terminals/checkouts/:checkout_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/terminals/checkouts/:checkout_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/terminals/checkouts/:checkout_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/terminals/checkouts/:checkout_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/terminals/checkouts/:checkout_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/terminals/checkouts/:checkout_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/terminals/checkouts/:checkout_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/terminals/checkouts/:checkout_id
http GET {{baseUrl}}/v2/terminals/checkouts/:checkout_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/terminals/checkouts/:checkout_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/terminals/checkouts/:checkout_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"checkout": {
"amount_money": {
"amount": 2610,
"currency": "USD"
},
"app_id": "APP_ID",
"created_at": "2020-04-06T16:39:32.545Z",
"deadline_duration": "PT10M",
"device_options": {
"device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false
}
},
"id": "08YceKh7B3ZqO",
"note": "A brief note",
"reference_id": "id11572",
"status": "IN_PROGRESS",
"updated_at": "2020-04-06T16:39:323.001Z"
}
}
GET
GetTerminalRefund
{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id
QUERY PARAMS
terminal_refund_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id")
require "http/client"
url = "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/terminals/refunds/:terminal_refund_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/terminals/refunds/:terminal_refund_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/terminals/refunds/:terminal_refund_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/terminals/refunds/:terminal_refund_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/terminals/refunds/:terminal_refund_id
http GET {{baseUrl}}/v2/terminals/refunds/:terminal_refund_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/terminals/refunds/:terminal_refund_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/terminals/refunds/:terminal_refund_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"refund": {
"amount_money": {
"amount": 111,
"currency": "CAD"
},
"app_id": "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ",
"card": {
"bin": "411111",
"card_brand": "INTERAC",
"card_type": "CREDIT",
"exp_month": 1,
"exp_year": 2022,
"fingerprint": "sq-1-B1fP9MNNmZgVVaPKRND6oDKYbz25S2cTvg9Mzwg3RMTK1zT1PiGRT-AE3nTA8vSmmw",
"last_4": "1111"
},
"created_at": "2020-09-29T15:21:46.771Z",
"deadline_duration": "PT5M",
"device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291",
"id": "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY",
"location_id": "76C9W6K8CNNQ5",
"order_id": "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY",
"payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY",
"reason": "Returning item",
"refund_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb",
"status": "COMPLETED",
"updated_at": "2020-09-29T15:21:48.675Z"
}
}
POST
SearchTerminalCheckouts
{{baseUrl}}/v2/terminals/checkouts/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/terminals/checkouts/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/terminals/checkouts/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:filter {:created_at {:end_at ""
:start_at ""}
:device_id ""
:status ""}
:sort {:sort_order ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/terminals/checkouts/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/terminals/checkouts/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/terminals/checkouts/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/terminals/checkouts/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/terminals/checkouts/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 234
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/terminals/checkouts/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/terminals/checkouts/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/terminals/checkouts/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/terminals/checkouts/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
created_at: {
end_at: '',
start_at: ''
},
device_id: '',
status: ''
},
sort: {
sort_order: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/terminals/checkouts/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {created_at: {end_at: '', start_at: ''}, device_id: '', status: ''},
sort: {sort_order: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/terminals/checkouts/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"created_at":{"end_at":"","start_at":""},"device_id":"","status":""},"sort":{"sort_order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/terminals/checkouts/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "created_at": {\n "end_at": "",\n "start_at": ""\n },\n "device_id": "",\n "status": ""\n },\n "sort": {\n "sort_order": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/terminals/checkouts/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/terminals/checkouts/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {created_at: {end_at: '', start_at: ''}, device_id: '', status: ''},
sort: {sort_order: ''}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts/search',
headers: {'content-type': 'application/json'},
body: {
cursor: '',
limit: 0,
query: {
filter: {created_at: {end_at: '', start_at: ''}, device_id: '', status: ''},
sort: {sort_order: ''}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/terminals/checkouts/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
filter: {
created_at: {
end_at: '',
start_at: ''
},
device_id: '',
status: ''
},
sort: {
sort_order: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/checkouts/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {created_at: {end_at: '', start_at: ''}, device_id: '', status: ''},
sort: {sort_order: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/terminals/checkouts/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"created_at":{"end_at":"","start_at":""},"device_id":"","status":""},"sort":{"sort_order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"filter": @{ @"created_at": @{ @"end_at": @"", @"start_at": @"" }, @"device_id": @"", @"status": @"" }, @"sort": @{ @"sort_order": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/terminals/checkouts/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/terminals/checkouts/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/terminals/checkouts/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'device_id' => '',
'status' => ''
],
'sort' => [
'sort_order' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/terminals/checkouts/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/terminals/checkouts/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'device_id' => '',
'status' => ''
],
'sort' => [
'sort_order' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'device_id' => '',
'status' => ''
],
'sort' => [
'sort_order' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/terminals/checkouts/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/terminals/checkouts/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/terminals/checkouts/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/terminals/checkouts/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/terminals/checkouts/search"
payload = {
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": { "sort_order": "" }
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/terminals/checkouts/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/terminals/checkouts/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/terminals/checkouts/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/terminals/checkouts/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({
"filter": json!({
"created_at": json!({
"end_at": "",
"start_at": ""
}),
"device_id": "",
"status": ""
}),
"sort": json!({"sort_order": ""})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/terminals/checkouts/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}' | \
http POST {{baseUrl}}/v2/terminals/checkouts/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "created_at": {\n "end_at": "",\n "start_at": ""\n },\n "device_id": "",\n "status": ""\n },\n "sort": {\n "sort_order": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/terminals/checkouts/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": [
"filter": [
"created_at": [
"end_at": "",
"start_at": ""
],
"device_id": "",
"status": ""
],
"sort": ["sort_order": ""]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/terminals/checkouts/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"checkouts": [
{
"amount_money": {
"amount": 2610,
"currency": "USD"
},
"app_id": "APP_ID",
"created_at": "2020-03-31T18:13:15.921Z",
"deadline_duration": "PT10M",
"device_options": {
"device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003",
"skip_receipt_screen": false,
"tip_settings": {
"allow_tipping": false
}
},
"id": "tsQPvzwBpMqqO",
"note": "A brief note",
"payment_ids": [
"rXnhZzywrEk4vR6pw76fPZfgvaB"
],
"reference_id": "id14467",
"status": "COMPLETED",
"updated_at": "2020-03-31T18:13:52.725Z"
},
{
"amount_money": {
"amount": 2610,
"currency": "USD"
},
"app_id": "APP_ID",
"created_at": "2020-03-31T18:08:31.882Z",
"deadline_duration": "PT10M",
"device_options": {
"device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003",
"skip_receipt_screen": true,
"tip_settings": {
"allow_tipping": false
}
},
"id": "XlOPTgcEhrbqO",
"note": "A brief note",
"payment_ids": [
"VYBF861PaoKPP7Pih0TlbZiNvaB"
],
"reference_id": "id41623",
"status": "COMPLETED",
"updated_at": "2020-03-31T18:08:41.635Z"
}
],
"cursor": "RiTJqBoTuXlbLmmrPvEkX9iG7XnQ4W4RjGnH"
}
POST
SearchTerminalRefunds
{{baseUrl}}/v2/terminals/refunds/search
BODY json
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/terminals/refunds/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/terminals/refunds/search" {:content-type :json
:form-params {:cursor ""
:limit 0
:query {:filter {:created_at {:end_at ""
:start_at ""}
:device_id ""
:status ""}
:sort {:sort_order ""}}}})
require "http/client"
url = "{{baseUrl}}/v2/terminals/refunds/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/terminals/refunds/search"),
Content = new StringContent("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/terminals/refunds/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/terminals/refunds/search"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/terminals/refunds/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 234
{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/terminals/refunds/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/terminals/refunds/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/terminals/refunds/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/terminals/refunds/search")
.header("content-type", "application/json")
.body("{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {
created_at: {
end_at: '',
start_at: ''
},
device_id: '',
status: ''
},
sort: {
sort_order: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/terminals/refunds/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {created_at: {end_at: '', start_at: ''}, device_id: '', status: ''},
sort: {sort_order: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/terminals/refunds/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"created_at":{"end_at":"","start_at":""},"device_id":"","status":""},"sort":{"sort_order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/terminals/refunds/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "created_at": {\n "end_at": "",\n "start_at": ""\n },\n "device_id": "",\n "status": ""\n },\n "sort": {\n "sort_order": ""\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/terminals/refunds/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/terminals/refunds/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
cursor: '',
limit: 0,
query: {
filter: {created_at: {end_at: '', start_at: ''}, device_id: '', status: ''},
sort: {sort_order: ''}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds/search',
headers: {'content-type': 'application/json'},
body: {
cursor: '',
limit: 0,
query: {
filter: {created_at: {end_at: '', start_at: ''}, device_id: '', status: ''},
sort: {sort_order: ''}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/terminals/refunds/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cursor: '',
limit: 0,
query: {
filter: {
created_at: {
end_at: '',
start_at: ''
},
device_id: '',
status: ''
},
sort: {
sort_order: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/terminals/refunds/search',
headers: {'content-type': 'application/json'},
data: {
cursor: '',
limit: 0,
query: {
filter: {created_at: {end_at: '', start_at: ''}, device_id: '', status: ''},
sort: {sort_order: ''}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/terminals/refunds/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cursor":"","limit":0,"query":{"filter":{"created_at":{"end_at":"","start_at":""},"device_id":"","status":""},"sort":{"sort_order":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"cursor": @"",
@"limit": @0,
@"query": @{ @"filter": @{ @"created_at": @{ @"end_at": @"", @"start_at": @"" }, @"device_id": @"", @"status": @"" }, @"sort": @{ @"sort_order": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/terminals/refunds/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/terminals/refunds/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/terminals/refunds/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'device_id' => '',
'status' => ''
],
'sort' => [
'sort_order' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/terminals/refunds/search', [
'body' => '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/terminals/refunds/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'device_id' => '',
'status' => ''
],
'sort' => [
'sort_order' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cursor' => '',
'limit' => 0,
'query' => [
'filter' => [
'created_at' => [
'end_at' => '',
'start_at' => ''
],
'device_id' => '',
'status' => ''
],
'sort' => [
'sort_order' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/terminals/refunds/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/terminals/refunds/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/terminals/refunds/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/terminals/refunds/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/terminals/refunds/search"
payload = {
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": { "sort_order": "" }
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/terminals/refunds/search"
payload <- "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/terminals/refunds/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/terminals/refunds/search') do |req|
req.body = "{\n \"cursor\": \"\",\n \"limit\": 0,\n \"query\": {\n \"filter\": {\n \"created_at\": {\n \"end_at\": \"\",\n \"start_at\": \"\"\n },\n \"device_id\": \"\",\n \"status\": \"\"\n },\n \"sort\": {\n \"sort_order\": \"\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/terminals/refunds/search";
let payload = json!({
"cursor": "",
"limit": 0,
"query": json!({
"filter": json!({
"created_at": json!({
"end_at": "",
"start_at": ""
}),
"device_id": "",
"status": ""
}),
"sort": json!({"sort_order": ""})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/terminals/refunds/search \
--header 'content-type: application/json' \
--data '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}'
echo '{
"cursor": "",
"limit": 0,
"query": {
"filter": {
"created_at": {
"end_at": "",
"start_at": ""
},
"device_id": "",
"status": ""
},
"sort": {
"sort_order": ""
}
}
}' | \
http POST {{baseUrl}}/v2/terminals/refunds/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cursor": "",\n "limit": 0,\n "query": {\n "filter": {\n "created_at": {\n "end_at": "",\n "start_at": ""\n },\n "device_id": "",\n "status": ""\n },\n "sort": {\n "sort_order": ""\n }\n }\n}' \
--output-document \
- {{baseUrl}}/v2/terminals/refunds/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"cursor": "",
"limit": 0,
"query": [
"filter": [
"created_at": [
"end_at": "",
"start_at": ""
],
"device_id": "",
"status": ""
],
"sort": ["sort_order": ""]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/terminals/refunds/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"refunds": [
{
"amount_money": {
"amount": 111,
"currency": "CAD"
},
"app_id": "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ",
"card": {
"bin": "411111",
"card_brand": "INTERAC",
"card_type": "CREDIT",
"exp_month": 1,
"exp_year": 2022,
"fingerprint": "sq-1-B1fP9MNNmZgVVaPKRND6oDKYbz25S2cTvg9Mzwg3RMTK1zT1PiGRT-AE3nTA8vSmmw",
"last_4": "1111"
},
"created_at": "2020-09-29T15:21:46.771Z",
"deadline_duration": "PT5M",
"device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291",
"id": "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY",
"location_id": "76C9W6K8CNNQ5",
"order_id": "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY",
"payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY",
"reason": "Returning item",
"refund_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb",
"status": "COMPLETED",
"updated_at": "2020-09-29T15:21:48.675Z"
}
]
}
POST
CaptureTransaction
{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture
QUERY PARAMS
location_id
transaction_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture")
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/locations/:location_id/transactions/:transaction_id/capture HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id/transactions/:transaction_id/capture',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/locations/:location_id/transactions/:transaction_id/capture")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/locations/:location_id/transactions/:transaction_id/capture') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture
http POST {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/capture")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
POST
Charge
{{baseUrl}}/v2/locations/:location_id/transactions
QUERY PARAMS
location_id
BODY json
{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"verification_token": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id/transactions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/locations/:location_id/transactions" {:content-type :json
:form-params {:additional_recipients [{:amount_money {:amount 0
:currency ""}
:description ""
:location_id ""
:receivable_id ""}]
:amount_money {}
:billing_address {:address_line_1 ""
:address_line_2 ""
:address_line_3 ""
:administrative_district_level_1 ""
:administrative_district_level_2 ""
:administrative_district_level_3 ""
:country ""
:first_name ""
:last_name ""
:locality ""
:organization ""
:postal_code ""
:sublocality ""
:sublocality_2 ""
:sublocality_3 ""}
:buyer_email_address ""
:card_nonce ""
:customer_card_id ""
:customer_id ""
:delay_capture false
:idempotency_key ""
:note ""
:order_id ""
:reference_id ""
:shipping_address {}
:verification_token ""}})
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id/transactions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id/transactions"),
Content = new StringContent("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id/transactions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id/transactions"
payload := strings.NewReader("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/locations/:location_id/transactions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 914
{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"verification_token": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/locations/:location_id/transactions")
.setHeader("content-type", "application/json")
.setBody("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id/transactions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/locations/:location_id/transactions")
.header("content-type", "application/json")
.body("{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}")
.asString();
const data = JSON.stringify({
additional_recipients: [
{
amount_money: {
amount: 0,
currency: ''
},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
card_nonce: '',
customer_card_id: '',
customer_id: '',
delay_capture: false,
idempotency_key: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
verification_token: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/locations/:location_id/transactions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions',
headers: {'content-type': 'application/json'},
data: {
additional_recipients: [
{
amount_money: {amount: 0, currency: ''},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
card_nonce: '',
customer_card_id: '',
customer_id: '',
delay_capture: false,
idempotency_key: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
verification_token: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id/transactions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additional_recipients":[{"amount_money":{"amount":0,"currency":""},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"buyer_email_address":"","card_nonce":"","customer_card_id":"","customer_id":"","delay_capture":false,"idempotency_key":"","note":"","order_id":"","reference_id":"","shipping_address":{},"verification_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id/transactions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "additional_recipients": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "buyer_email_address": "",\n "card_nonce": "",\n "customer_card_id": "",\n "customer_id": "",\n "delay_capture": false,\n "idempotency_key": "",\n "note": "",\n "order_id": "",\n "reference_id": "",\n "shipping_address": {},\n "verification_token": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id/transactions',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
additional_recipients: [
{
amount_money: {amount: 0, currency: ''},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
card_nonce: '',
customer_card_id: '',
customer_id: '',
delay_capture: false,
idempotency_key: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
verification_token: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions',
headers: {'content-type': 'application/json'},
body: {
additional_recipients: [
{
amount_money: {amount: 0, currency: ''},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
card_nonce: '',
customer_card_id: '',
customer_id: '',
delay_capture: false,
idempotency_key: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
verification_token: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/locations/:location_id/transactions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
additional_recipients: [
{
amount_money: {
amount: 0,
currency: ''
},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
card_nonce: '',
customer_card_id: '',
customer_id: '',
delay_capture: false,
idempotency_key: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
verification_token: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions',
headers: {'content-type': 'application/json'},
data: {
additional_recipients: [
{
amount_money: {amount: 0, currency: ''},
description: '',
location_id: '',
receivable_id: ''
}
],
amount_money: {},
billing_address: {
address_line_1: '',
address_line_2: '',
address_line_3: '',
administrative_district_level_1: '',
administrative_district_level_2: '',
administrative_district_level_3: '',
country: '',
first_name: '',
last_name: '',
locality: '',
organization: '',
postal_code: '',
sublocality: '',
sublocality_2: '',
sublocality_3: ''
},
buyer_email_address: '',
card_nonce: '',
customer_card_id: '',
customer_id: '',
delay_capture: false,
idempotency_key: '',
note: '',
order_id: '',
reference_id: '',
shipping_address: {},
verification_token: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id/transactions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"additional_recipients":[{"amount_money":{"amount":0,"currency":""},"description":"","location_id":"","receivable_id":""}],"amount_money":{},"billing_address":{"address_line_1":"","address_line_2":"","address_line_3":"","administrative_district_level_1":"","administrative_district_level_2":"","administrative_district_level_3":"","country":"","first_name":"","last_name":"","locality":"","organization":"","postal_code":"","sublocality":"","sublocality_2":"","sublocality_3":""},"buyer_email_address":"","card_nonce":"","customer_card_id":"","customer_id":"","delay_capture":false,"idempotency_key":"","note":"","order_id":"","reference_id":"","shipping_address":{},"verification_token":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"additional_recipients": @[ @{ @"amount_money": @{ @"amount": @0, @"currency": @"" }, @"description": @"", @"location_id": @"", @"receivable_id": @"" } ],
@"amount_money": @{ },
@"billing_address": @{ @"address_line_1": @"", @"address_line_2": @"", @"address_line_3": @"", @"administrative_district_level_1": @"", @"administrative_district_level_2": @"", @"administrative_district_level_3": @"", @"country": @"", @"first_name": @"", @"last_name": @"", @"locality": @"", @"organization": @"", @"postal_code": @"", @"sublocality": @"", @"sublocality_2": @"", @"sublocality_3": @"" },
@"buyer_email_address": @"",
@"card_nonce": @"",
@"customer_card_id": @"",
@"customer_id": @"",
@"delay_capture": @NO,
@"idempotency_key": @"",
@"note": @"",
@"order_id": @"",
@"reference_id": @"",
@"shipping_address": @{ },
@"verification_token": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id/transactions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id/transactions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'additional_recipients' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'card_nonce' => '',
'customer_card_id' => '',
'customer_id' => '',
'delay_capture' => null,
'idempotency_key' => '',
'note' => '',
'order_id' => '',
'reference_id' => '',
'shipping_address' => [
],
'verification_token' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/locations/:location_id/transactions', [
'body' => '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"verification_token": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id/transactions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'additional_recipients' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'card_nonce' => '',
'customer_card_id' => '',
'customer_id' => '',
'delay_capture' => null,
'idempotency_key' => '',
'note' => '',
'order_id' => '',
'reference_id' => '',
'shipping_address' => [
],
'verification_token' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'additional_recipients' => [
[
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'description' => '',
'location_id' => '',
'receivable_id' => ''
]
],
'amount_money' => [
],
'billing_address' => [
'address_line_1' => '',
'address_line_2' => '',
'address_line_3' => '',
'administrative_district_level_1' => '',
'administrative_district_level_2' => '',
'administrative_district_level_3' => '',
'country' => '',
'first_name' => '',
'last_name' => '',
'locality' => '',
'organization' => '',
'postal_code' => '',
'sublocality' => '',
'sublocality_2' => '',
'sublocality_3' => ''
],
'buyer_email_address' => '',
'card_nonce' => '',
'customer_card_id' => '',
'customer_id' => '',
'delay_capture' => null,
'idempotency_key' => '',
'note' => '',
'order_id' => '',
'reference_id' => '',
'shipping_address' => [
],
'verification_token' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/locations/:location_id/transactions');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id/transactions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"verification_token": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id/transactions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"verification_token": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/locations/:location_id/transactions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id/transactions"
payload = {
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": False,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"verification_token": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id/transactions"
payload <- "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id/transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/locations/:location_id/transactions') do |req|
req.body = "{\n \"additional_recipients\": [\n {\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"description\": \"\",\n \"location_id\": \"\",\n \"receivable_id\": \"\"\n }\n ],\n \"amount_money\": {},\n \"billing_address\": {\n \"address_line_1\": \"\",\n \"address_line_2\": \"\",\n \"address_line_3\": \"\",\n \"administrative_district_level_1\": \"\",\n \"administrative_district_level_2\": \"\",\n \"administrative_district_level_3\": \"\",\n \"country\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"locality\": \"\",\n \"organization\": \"\",\n \"postal_code\": \"\",\n \"sublocality\": \"\",\n \"sublocality_2\": \"\",\n \"sublocality_3\": \"\"\n },\n \"buyer_email_address\": \"\",\n \"card_nonce\": \"\",\n \"customer_card_id\": \"\",\n \"customer_id\": \"\",\n \"delay_capture\": false,\n \"idempotency_key\": \"\",\n \"note\": \"\",\n \"order_id\": \"\",\n \"reference_id\": \"\",\n \"shipping_address\": {},\n \"verification_token\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id/transactions";
let payload = json!({
"additional_recipients": (
json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"description": "",
"location_id": "",
"receivable_id": ""
})
),
"amount_money": json!({}),
"billing_address": json!({
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
}),
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": json!({}),
"verification_token": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/locations/:location_id/transactions \
--header 'content-type: application/json' \
--data '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"verification_token": ""
}'
echo '{
"additional_recipients": [
{
"amount_money": {
"amount": 0,
"currency": ""
},
"description": "",
"location_id": "",
"receivable_id": ""
}
],
"amount_money": {},
"billing_address": {
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
},
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": {},
"verification_token": ""
}' | \
http POST {{baseUrl}}/v2/locations/:location_id/transactions \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "additional_recipients": [\n {\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "description": "",\n "location_id": "",\n "receivable_id": ""\n }\n ],\n "amount_money": {},\n "billing_address": {\n "address_line_1": "",\n "address_line_2": "",\n "address_line_3": "",\n "administrative_district_level_1": "",\n "administrative_district_level_2": "",\n "administrative_district_level_3": "",\n "country": "",\n "first_name": "",\n "last_name": "",\n "locality": "",\n "organization": "",\n "postal_code": "",\n "sublocality": "",\n "sublocality_2": "",\n "sublocality_3": ""\n },\n "buyer_email_address": "",\n "card_nonce": "",\n "customer_card_id": "",\n "customer_id": "",\n "delay_capture": false,\n "idempotency_key": "",\n "note": "",\n "order_id": "",\n "reference_id": "",\n "shipping_address": {},\n "verification_token": ""\n}' \
--output-document \
- {{baseUrl}}/v2/locations/:location_id/transactions
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"additional_recipients": [
[
"amount_money": [
"amount": 0,
"currency": ""
],
"description": "",
"location_id": "",
"receivable_id": ""
]
],
"amount_money": [],
"billing_address": [
"address_line_1": "",
"address_line_2": "",
"address_line_3": "",
"administrative_district_level_1": "",
"administrative_district_level_2": "",
"administrative_district_level_3": "",
"country": "",
"first_name": "",
"last_name": "",
"locality": "",
"organization": "",
"postal_code": "",
"sublocality": "",
"sublocality_2": "",
"sublocality_3": ""
],
"buyer_email_address": "",
"card_nonce": "",
"customer_card_id": "",
"customer_id": "",
"delay_capture": false,
"idempotency_key": "",
"note": "",
"order_id": "",
"reference_id": "",
"shipping_address": [],
"verification_token": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id/transactions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"transaction": {
"created_at": "2016-03-10T22:57:56Z",
"id": "KnL67ZIwXCPtzOrqj0HrkxMF",
"location_id": "18YC4JDH91E1H",
"product": "EXTERNAL_API",
"reference_id": "some optional reference id",
"tenders": [
{
"additional_recipients": [
{
"amount_money": {
"amount": 20,
"currency": "USD"
},
"description": "Application fees",
"location_id": "057P5VYJ4A5X1",
"receivable_id": "ISu5xwxJ5v0CMJTQq7RvqyMF"
}
],
"amount_money": {
"amount": 200,
"currency": "USD"
},
"card_details": {
"card": {
"card_brand": "VISA",
"last_4": "1111"
},
"entry_method": "KEYED",
"status": "CAPTURED"
},
"created_at": "2016-03-10T22:57:56Z",
"id": "MtZRYYdDrYNQbOvV7nbuBvMF",
"location_id": "18YC4JDH91E1H",
"note": "some optional note",
"transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF",
"type": "CARD"
}
]
}
}
POST
CreateRefund (POST)
{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund
QUERY PARAMS
location_id
transaction_id
BODY json
{
"amount_money": {
"amount": 0,
"currency": ""
},
"idempotency_key": "",
"reason": "",
"tender_id": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund" {:content-type :json
:form-params {:amount_money {:amount 0
:currency ""}
:idempotency_key ""
:reason ""
:tender_id ""}})
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund"),
Content = new StringContent("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund"
payload := strings.NewReader("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/locations/:location_id/transactions/:transaction_id/refund HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 123
{
"amount_money": {
"amount": 0,
"currency": ""
},
"idempotency_key": "",
"reason": "",
"tender_id": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund")
.setHeader("content-type", "application/json")
.setBody("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund")
.header("content-type", "application/json")
.body("{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}")
.asString();
const data = JSON.stringify({
amount_money: {
amount: 0,
currency: ''
},
idempotency_key: '',
reason: '',
tender_id: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund',
headers: {'content-type': 'application/json'},
data: {
amount_money: {amount: 0, currency: ''},
idempotency_key: '',
reason: '',
tender_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"amount_money":{"amount":0,"currency":""},"idempotency_key":"","reason":"","tender_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "idempotency_key": "",\n "reason": "",\n "tender_id": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id/transactions/:transaction_id/refund',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
amount_money: {amount: 0, currency: ''},
idempotency_key: '',
reason: '',
tender_id: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund',
headers: {'content-type': 'application/json'},
body: {
amount_money: {amount: 0, currency: ''},
idempotency_key: '',
reason: '',
tender_id: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
amount_money: {
amount: 0,
currency: ''
},
idempotency_key: '',
reason: '',
tender_id: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund',
headers: {'content-type': 'application/json'},
data: {
amount_money: {amount: 0, currency: ''},
idempotency_key: '',
reason: '',
tender_id: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"amount_money":{"amount":0,"currency":""},"idempotency_key":"","reason":"","tender_id":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"amount_money": @{ @"amount": @0, @"currency": @"" },
@"idempotency_key": @"",
@"reason": @"",
@"tender_id": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'idempotency_key' => '',
'reason' => '',
'tender_id' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund', [
'body' => '{
"amount_money": {
"amount": 0,
"currency": ""
},
"idempotency_key": "",
"reason": "",
"tender_id": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'idempotency_key' => '',
'reason' => '',
'tender_id' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'amount_money' => [
'amount' => 0,
'currency' => ''
],
'idempotency_key' => '',
'reason' => '',
'tender_id' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"amount_money": {
"amount": 0,
"currency": ""
},
"idempotency_key": "",
"reason": "",
"tender_id": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"amount_money": {
"amount": 0,
"currency": ""
},
"idempotency_key": "",
"reason": "",
"tender_id": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/locations/:location_id/transactions/:transaction_id/refund", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund"
payload = {
"amount_money": {
"amount": 0,
"currency": ""
},
"idempotency_key": "",
"reason": "",
"tender_id": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund"
payload <- "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v2/locations/:location_id/transactions/:transaction_id/refund') do |req|
req.body = "{\n \"amount_money\": {\n \"amount\": 0,\n \"currency\": \"\"\n },\n \"idempotency_key\": \"\",\n \"reason\": \"\",\n \"tender_id\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund";
let payload = json!({
"amount_money": json!({
"amount": 0,
"currency": ""
}),
"idempotency_key": "",
"reason": "",
"tender_id": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund \
--header 'content-type: application/json' \
--data '{
"amount_money": {
"amount": 0,
"currency": ""
},
"idempotency_key": "",
"reason": "",
"tender_id": ""
}'
echo '{
"amount_money": {
"amount": 0,
"currency": ""
},
"idempotency_key": "",
"reason": "",
"tender_id": ""
}' | \
http POST {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "amount_money": {\n "amount": 0,\n "currency": ""\n },\n "idempotency_key": "",\n "reason": "",\n "tender_id": ""\n}' \
--output-document \
- {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"amount_money": [
"amount": 0,
"currency": ""
],
"idempotency_key": "",
"reason": "",
"tender_id": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/refund")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"refund": {
"additional_recipients": [
{
"amount_money": {
"amount": 10,
"currency": "USD"
},
"description": "Application fees",
"location_id": "057P5VYJ4A5X1",
"receivable_id": "ISu5xwxJ5v0CMJTQq7RvqyMF"
}
],
"amount_money": {
"amount": 100,
"currency": "USD"
},
"created_at": "2016-02-12T00:28:18Z",
"id": "b27436d1-7f8e-5610-45c6-417ef71434b4-SW",
"location_id": "18YC4JDH91E1H",
"reason": "some reason",
"status": "PENDING",
"tender_id": "MtZRYYdDrYNQbOvV7nbuBvMF",
"transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF"
}
}
GET
ListRefunds (GET)
{{baseUrl}}/v2/locations/:location_id/refunds
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id/refunds");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/locations/:location_id/refunds")
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id/refunds"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id/refunds"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id/refunds");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id/refunds"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/locations/:location_id/refunds HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/locations/:location_id/refunds")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id/refunds"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/refunds")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/locations/:location_id/refunds")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/locations/:location_id/refunds');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/refunds'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id/refunds';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id/refunds',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/refunds")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id/refunds',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/refunds'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/locations/:location_id/refunds');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/refunds'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id/refunds';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id/refunds"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id/refunds" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id/refunds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/locations/:location_id/refunds');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id/refunds');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/locations/:location_id/refunds');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id/refunds' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id/refunds' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/locations/:location_id/refunds")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id/refunds"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id/refunds"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/locations/:location_id/refunds') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id/refunds";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/locations/:location_id/refunds
http GET {{baseUrl}}/v2/locations/:location_id/refunds
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/locations/:location_id/refunds
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id/refunds")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"refunds": [
{
"additional_recipients": [
{
"amount_money": {
"amount": 10,
"currency": "USD"
},
"description": "Application fees",
"location_id": "057P5VYJ4A5X1"
}
],
"amount_money": {
"amount": 100,
"currency": "USD"
},
"created_at": "2016-01-20T00:28:18Z",
"id": "b27436d1-7f8e-5610-45c6-417ef71434b4-SW",
"location_id": "18YC4JDH91E1H",
"reason": "some reason",
"status": "APPROVED",
"tender_id": "MtZRYYdDrYNQbOvV7nbuBvMF",
"transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF"
}
]
}
GET
ListTransactions
{{baseUrl}}/v2/locations/:location_id/transactions
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id/transactions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/locations/:location_id/transactions")
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id/transactions"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id/transactions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id/transactions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id/transactions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/locations/:location_id/transactions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/locations/:location_id/transactions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id/transactions"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/locations/:location_id/transactions")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/locations/:location_id/transactions');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/transactions'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id/transactions';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id/transactions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id/transactions',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/transactions'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/locations/:location_id/transactions');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/transactions'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id/transactions';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id/transactions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id/transactions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/locations/:location_id/transactions');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id/transactions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/locations/:location_id/transactions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id/transactions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id/transactions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/locations/:location_id/transactions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id/transactions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id/transactions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id/transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/locations/:location_id/transactions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id/transactions";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/locations/:location_id/transactions
http GET {{baseUrl}}/v2/locations/:location_id/transactions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/locations/:location_id/transactions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id/transactions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"transactions": [
{
"created_at": "2016-01-20T22:57:56Z",
"id": "KnL67ZIwXCPtzOrqj0HrkxMF",
"location_id": "18YC4JDH91E1H",
"product": "EXTERNAL_API",
"reference_id": "some optional reference id",
"refunds": [
{
"additional_recipients": [
{
"amount_money": {
"amount": 100,
"currency": "USD"
},
"description": "Application fees",
"location_id": "057P5VYJ4A5X1"
}
],
"amount_money": {
"amount": 5000,
"currency": "USD"
},
"created_at": "2016-01-20T22:59:20Z",
"id": "7a5RcVI0CxbOcJ2wMOkE",
"location_id": "18YC4JDH91E1H",
"processing_fee_money": {
"amount": 138,
"currency": "USD"
},
"reason": "some reason why",
"status": "APPROVED",
"tender_id": "MtZRYYdDrYNQbOvV7nbuBvMF",
"transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF"
}
],
"tenders": [
{
"additional_recipients": [
{
"amount_money": {
"amount": 20,
"currency": "USD"
},
"description": "Application fees",
"location_id": "057P5VYJ4A5X1"
}
],
"amount_money": {
"amount": 5000,
"currency": "USD"
},
"card_details": {
"card": {
"card_brand": "VISA",
"last_4": "1111"
},
"entry_method": "KEYED",
"status": "CAPTURED"
},
"created_at": "2016-01-20T22:57:56Z",
"id": "MtZRYYdDrYNQbOvV7nbuBvMF",
"location_id": "18YC4JDH91E1H",
"note": "some optional note",
"processing_fee_money": {
"amount": 138,
"currency": "USD"
},
"transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF",
"type": "CARD"
}
]
}
]
}
GET
RetrieveTransaction
{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id
QUERY PARAMS
location_id
transaction_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id")
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v2/locations/:location_id/transactions/:transaction_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id/transactions/:transaction_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/locations/:location_id/transactions/:transaction_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v2/locations/:location_id/transactions/:transaction_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id
http GET {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"transaction": {
"created_at": "2016-03-10T22:57:56Z",
"id": "KnL67ZIwXCPtzOrqj0HrkxMF",
"location_id": "18YC4JDH91E1H",
"product": "EXTERNAL_API",
"reference_id": "some optional reference id",
"tenders": [
{
"additional_recipients": [
{
"amount_money": {
"amount": 20,
"currency": "USD"
},
"description": "Application fees",
"location_id": "057P5VYJ4A5X1"
}
],
"amount_money": {
"amount": 5000,
"currency": "USD"
},
"card_details": {
"card": {
"card_brand": "VISA",
"last_4": "1111"
},
"entry_method": "KEYED",
"status": "CAPTURED"
},
"created_at": "2016-03-10T22:57:56Z",
"id": "MtZRYYdDrYNQbOvV7nbuBvMF",
"location_id": "18YC4JDH91E1H",
"note": "some optional note",
"processing_fee_money": {
"amount": 138,
"currency": "USD"
},
"transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF",
"type": "CARD"
}
]
}
}
POST
VoidTransaction
{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void
QUERY PARAMS
location_id
transaction_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void")
require "http/client"
url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v2/locations/:location_id/transactions/:transaction_id/void HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/locations/:location_id/transactions/:transaction_id/void',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/locations/:location_id/transactions/:transaction_id/void")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/v2/locations/:location_id/transactions/:transaction_id/void') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void
http POST {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/locations/:location_id/transactions/:transaction_id/void")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{}
POST
CreateEmployee
{{baseUrl}}/v1/me/employees
BODY json
{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/me/employees");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/me/employees" {:content-type :json
:form-params {:authorized_location_ids []
:created_at ""
:email ""
:external_id ""
:first_name ""
:id ""
:last_name ""
:role_ids []
:status ""
:updated_at ""}})
require "http/client"
url = "{{baseUrl}}/v1/me/employees"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/me/employees"),
Content = new StringContent("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/me/employees");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/me/employees"
payload := strings.NewReader("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/me/employees HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 196
{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/me/employees")
.setHeader("content-type", "application/json")
.setBody("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/me/employees"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/me/employees")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/me/employees")
.header("content-type", "application/json")
.body("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
.asString();
const data = JSON.stringify({
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/me/employees');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/me/employees',
headers: {'content-type': 'application/json'},
data: {
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/me/employees';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"authorized_location_ids":[],"created_at":"","email":"","external_id":"","first_name":"","id":"","last_name":"","role_ids":[],"status":"","updated_at":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/me/employees',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "authorized_location_ids": [],\n "created_at": "",\n "email": "",\n "external_id": "",\n "first_name": "",\n "id": "",\n "last_name": "",\n "role_ids": [],\n "status": "",\n "updated_at": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/me/employees")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/me/employees',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/me/employees',
headers: {'content-type': 'application/json'},
body: {
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/me/employees');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/me/employees',
headers: {'content-type': 'application/json'},
data: {
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/me/employees';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"authorized_location_ids":[],"created_at":"","email":"","external_id":"","first_name":"","id":"","last_name":"","role_ids":[],"status":"","updated_at":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"authorized_location_ids": @[ ],
@"created_at": @"",
@"email": @"",
@"external_id": @"",
@"first_name": @"",
@"id": @"",
@"last_name": @"",
@"role_ids": @[ ],
@"status": @"",
@"updated_at": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/me/employees"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/me/employees" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/me/employees",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'authorized_location_ids' => [
],
'created_at' => '',
'email' => '',
'external_id' => '',
'first_name' => '',
'id' => '',
'last_name' => '',
'role_ids' => [
],
'status' => '',
'updated_at' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/me/employees', [
'body' => '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/me/employees');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'authorized_location_ids' => [
],
'created_at' => '',
'email' => '',
'external_id' => '',
'first_name' => '',
'id' => '',
'last_name' => '',
'role_ids' => [
],
'status' => '',
'updated_at' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'authorized_location_ids' => [
],
'created_at' => '',
'email' => '',
'external_id' => '',
'first_name' => '',
'id' => '',
'last_name' => '',
'role_ids' => [
],
'status' => '',
'updated_at' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/me/employees');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/me/employees' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/me/employees' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/me/employees", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/me/employees"
payload = {
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/me/employees"
payload <- "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/me/employees")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/me/employees') do |req|
req.body = "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/me/employees";
let payload = json!({
"authorized_location_ids": (),
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": (),
"status": "",
"updated_at": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/me/employees \
--header 'content-type: application/json' \
--data '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}'
echo '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}' | \
http POST {{baseUrl}}/v1/me/employees \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "authorized_location_ids": [],\n "created_at": "",\n "email": "",\n "external_id": "",\n "first_name": "",\n "id": "",\n "last_name": "",\n "role_ids": [],\n "status": "",\n "updated_at": ""\n}' \
--output-document \
- {{baseUrl}}/v1/me/employees
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/me/employees")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
CreateEmployeeRole
{{baseUrl}}/v1/me/roles
BODY json
{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/me/roles");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/me/roles" {:content-type :json
:form-params {:created_at ""
:id ""
:is_owner false
:name ""
:permissions []
:updated_at ""}})
require "http/client"
url = "{{baseUrl}}/v1/me/roles"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/me/roles"),
Content = new StringContent("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/me/roles");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/me/roles"
payload := strings.NewReader("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/me/roles HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 110
{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/me/roles")
.setHeader("content-type", "application/json")
.setBody("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/me/roles"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/me/roles")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/me/roles")
.header("content-type", "application/json")
.body("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
.asString();
const data = JSON.stringify({
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/me/roles');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/me/roles',
headers: {'content-type': 'application/json'},
data: {
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/me/roles';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_at":"","id":"","is_owner":false,"name":"","permissions":[],"updated_at":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/me/roles',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created_at": "",\n "id": "",\n "is_owner": false,\n "name": "",\n "permissions": [],\n "updated_at": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/me/roles")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/me/roles',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/me/roles',
headers: {'content-type': 'application/json'},
body: {
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/me/roles');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/me/roles',
headers: {'content-type': 'application/json'},
data: {
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/me/roles';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"created_at":"","id":"","is_owner":false,"name":"","permissions":[],"updated_at":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"created_at": @"",
@"id": @"",
@"is_owner": @NO,
@"name": @"",
@"permissions": @[ ],
@"updated_at": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/me/roles"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/me/roles" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/me/roles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'created_at' => '',
'id' => '',
'is_owner' => null,
'name' => '',
'permissions' => [
],
'updated_at' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/me/roles', [
'body' => '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/me/roles');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created_at' => '',
'id' => '',
'is_owner' => null,
'name' => '',
'permissions' => [
],
'updated_at' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created_at' => '',
'id' => '',
'is_owner' => null,
'name' => '',
'permissions' => [
],
'updated_at' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/me/roles');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/me/roles' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/me/roles' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/me/roles", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/me/roles"
payload = {
"created_at": "",
"id": "",
"is_owner": False,
"name": "",
"permissions": [],
"updated_at": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/me/roles"
payload <- "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/me/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/me/roles') do |req|
req.body = "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/me/roles";
let payload = json!({
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": (),
"updated_at": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/me/roles \
--header 'content-type: application/json' \
--data '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}'
echo '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}' | \
http POST {{baseUrl}}/v1/me/roles \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "created_at": "",\n "id": "",\n "is_owner": false,\n "name": "",\n "permissions": [],\n "updated_at": ""\n}' \
--output-document \
- {{baseUrl}}/v1/me/roles
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/me/roles")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ListEmployeeRoles
{{baseUrl}}/v1/me/roles
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/me/roles");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/me/roles")
require "http/client"
url = "{{baseUrl}}/v1/me/roles"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/me/roles"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/me/roles");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/me/roles"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/me/roles HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/me/roles")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/me/roles"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/me/roles")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/me/roles")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/me/roles');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/roles'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/me/roles';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/me/roles',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/me/roles")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/me/roles',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/roles'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/me/roles');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/roles'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/me/roles';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/me/roles"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/me/roles" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/me/roles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/me/roles');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/me/roles');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/me/roles');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/me/roles' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/me/roles' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/me/roles")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/me/roles"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/me/roles"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/me/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/me/roles') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/me/roles";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/me/roles
http GET {{baseUrl}}/v1/me/roles
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/me/roles
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/me/roles")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ListEmployees
{{baseUrl}}/v1/me/employees
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/me/employees");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/me/employees")
require "http/client"
url = "{{baseUrl}}/v1/me/employees"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/me/employees"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/me/employees");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/me/employees"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/me/employees HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/me/employees")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/me/employees"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/me/employees")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/me/employees")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/me/employees');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/employees'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/me/employees';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/me/employees',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/me/employees")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/me/employees',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/employees'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/me/employees');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/employees'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/me/employees';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/me/employees"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/me/employees" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/me/employees",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/me/employees');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/me/employees');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/me/employees');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/me/employees' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/me/employees' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/me/employees")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/me/employees"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/me/employees"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/me/employees")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/me/employees') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/me/employees";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/me/employees
http GET {{baseUrl}}/v1/me/employees
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/me/employees
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/me/employees")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
RetrieveEmployee
{{baseUrl}}/v1/me/employees/:employee_id
QUERY PARAMS
employee_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/me/employees/:employee_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/me/employees/:employee_id")
require "http/client"
url = "{{baseUrl}}/v1/me/employees/:employee_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/me/employees/:employee_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/me/employees/:employee_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/me/employees/:employee_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/me/employees/:employee_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/me/employees/:employee_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/me/employees/:employee_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/me/employees/:employee_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/me/employees/:employee_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/me/employees/:employee_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/employees/:employee_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/me/employees/:employee_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/me/employees/:employee_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/me/employees/:employee_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/me/employees/:employee_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/employees/:employee_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/me/employees/:employee_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/employees/:employee_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/me/employees/:employee_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/me/employees/:employee_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/me/employees/:employee_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/me/employees/:employee_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/me/employees/:employee_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/me/employees/:employee_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/me/employees/:employee_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/me/employees/:employee_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/me/employees/:employee_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/me/employees/:employee_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/me/employees/:employee_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/me/employees/:employee_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/me/employees/:employee_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/me/employees/:employee_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/me/employees/:employee_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/me/employees/:employee_id
http GET {{baseUrl}}/v1/me/employees/:employee_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/me/employees/:employee_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/me/employees/:employee_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
RetrieveEmployeeRole
{{baseUrl}}/v1/me/roles/:role_id
QUERY PARAMS
role_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/me/roles/:role_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/me/roles/:role_id")
require "http/client"
url = "{{baseUrl}}/v1/me/roles/:role_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/me/roles/:role_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/me/roles/:role_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/me/roles/:role_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/me/roles/:role_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/me/roles/:role_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/me/roles/:role_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/me/roles/:role_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/me/roles/:role_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/me/roles/:role_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/roles/:role_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/me/roles/:role_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/me/roles/:role_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/me/roles/:role_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/me/roles/:role_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/roles/:role_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/me/roles/:role_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/me/roles/:role_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/me/roles/:role_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/me/roles/:role_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/me/roles/:role_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/me/roles/:role_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/me/roles/:role_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/me/roles/:role_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/me/roles/:role_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/me/roles/:role_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/me/roles/:role_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/me/roles/:role_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/me/roles/:role_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/me/roles/:role_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/me/roles/:role_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/me/roles/:role_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/me/roles/:role_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/me/roles/:role_id
http GET {{baseUrl}}/v1/me/roles/:role_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/me/roles/:role_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/me/roles/:role_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
UpdateEmployee
{{baseUrl}}/v1/me/employees/:employee_id
QUERY PARAMS
employee_id
BODY json
{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/me/employees/:employee_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v1/me/employees/:employee_id" {:content-type :json
:form-params {:authorized_location_ids []
:created_at ""
:email ""
:external_id ""
:first_name ""
:id ""
:last_name ""
:role_ids []
:status ""
:updated_at ""}})
require "http/client"
url = "{{baseUrl}}/v1/me/employees/:employee_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v1/me/employees/:employee_id"),
Content = new StringContent("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/me/employees/:employee_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/me/employees/:employee_id"
payload := strings.NewReader("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v1/me/employees/:employee_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 196
{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v1/me/employees/:employee_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/me/employees/:employee_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/me/employees/:employee_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v1/me/employees/:employee_id")
.header("content-type", "application/json")
.body("{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
.asString();
const data = JSON.stringify({
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v1/me/employees/:employee_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/me/employees/:employee_id',
headers: {'content-type': 'application/json'},
data: {
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/me/employees/:employee_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"authorized_location_ids":[],"created_at":"","email":"","external_id":"","first_name":"","id":"","last_name":"","role_ids":[],"status":"","updated_at":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/me/employees/:employee_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "authorized_location_ids": [],\n "created_at": "",\n "email": "",\n "external_id": "",\n "first_name": "",\n "id": "",\n "last_name": "",\n "role_ids": [],\n "status": "",\n "updated_at": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/me/employees/:employee_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/me/employees/:employee_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/me/employees/:employee_id',
headers: {'content-type': 'application/json'},
body: {
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v1/me/employees/:employee_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/me/employees/:employee_id',
headers: {'content-type': 'application/json'},
data: {
authorized_location_ids: [],
created_at: '',
email: '',
external_id: '',
first_name: '',
id: '',
last_name: '',
role_ids: [],
status: '',
updated_at: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/me/employees/:employee_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"authorized_location_ids":[],"created_at":"","email":"","external_id":"","first_name":"","id":"","last_name":"","role_ids":[],"status":"","updated_at":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"authorized_location_ids": @[ ],
@"created_at": @"",
@"email": @"",
@"external_id": @"",
@"first_name": @"",
@"id": @"",
@"last_name": @"",
@"role_ids": @[ ],
@"status": @"",
@"updated_at": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/me/employees/:employee_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/me/employees/:employee_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/me/employees/:employee_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'authorized_location_ids' => [
],
'created_at' => '',
'email' => '',
'external_id' => '',
'first_name' => '',
'id' => '',
'last_name' => '',
'role_ids' => [
],
'status' => '',
'updated_at' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v1/me/employees/:employee_id', [
'body' => '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/me/employees/:employee_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'authorized_location_ids' => [
],
'created_at' => '',
'email' => '',
'external_id' => '',
'first_name' => '',
'id' => '',
'last_name' => '',
'role_ids' => [
],
'status' => '',
'updated_at' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'authorized_location_ids' => [
],
'created_at' => '',
'email' => '',
'external_id' => '',
'first_name' => '',
'id' => '',
'last_name' => '',
'role_ids' => [
],
'status' => '',
'updated_at' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/me/employees/:employee_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/me/employees/:employee_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/me/employees/:employee_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v1/me/employees/:employee_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/me/employees/:employee_id"
payload = {
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/me/employees/:employee_id"
payload <- "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/me/employees/:employee_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v1/me/employees/:employee_id') do |req|
req.body = "{\n \"authorized_location_ids\": [],\n \"created_at\": \"\",\n \"email\": \"\",\n \"external_id\": \"\",\n \"first_name\": \"\",\n \"id\": \"\",\n \"last_name\": \"\",\n \"role_ids\": [],\n \"status\": \"\",\n \"updated_at\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/me/employees/:employee_id";
let payload = json!({
"authorized_location_ids": (),
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": (),
"status": "",
"updated_at": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v1/me/employees/:employee_id \
--header 'content-type: application/json' \
--data '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}'
echo '{
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
}' | \
http PUT {{baseUrl}}/v1/me/employees/:employee_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "authorized_location_ids": [],\n "created_at": "",\n "email": "",\n "external_id": "",\n "first_name": "",\n "id": "",\n "last_name": "",\n "role_ids": [],\n "status": "",\n "updated_at": ""\n}' \
--output-document \
- {{baseUrl}}/v1/me/employees/:employee_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"authorized_location_ids": [],
"created_at": "",
"email": "",
"external_id": "",
"first_name": "",
"id": "",
"last_name": "",
"role_ids": [],
"status": "",
"updated_at": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/me/employees/:employee_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
UpdateEmployeeRole
{{baseUrl}}/v1/me/roles/:role_id
QUERY PARAMS
role_id
BODY json
{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/me/roles/:role_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v1/me/roles/:role_id" {:content-type :json
:form-params {:created_at ""
:id ""
:is_owner false
:name ""
:permissions []
:updated_at ""}})
require "http/client"
url = "{{baseUrl}}/v1/me/roles/:role_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v1/me/roles/:role_id"),
Content = new StringContent("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/me/roles/:role_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/me/roles/:role_id"
payload := strings.NewReader("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v1/me/roles/:role_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 110
{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v1/me/roles/:role_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/me/roles/:role_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/me/roles/:role_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v1/me/roles/:role_id")
.header("content-type", "application/json")
.body("{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
.asString();
const data = JSON.stringify({
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v1/me/roles/:role_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/me/roles/:role_id',
headers: {'content-type': 'application/json'},
data: {
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/me/roles/:role_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created_at":"","id":"","is_owner":false,"name":"","permissions":[],"updated_at":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/me/roles/:role_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "created_at": "",\n "id": "",\n "is_owner": false,\n "name": "",\n "permissions": [],\n "updated_at": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/me/roles/:role_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/me/roles/:role_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/me/roles/:role_id',
headers: {'content-type': 'application/json'},
body: {
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v1/me/roles/:role_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/me/roles/:role_id',
headers: {'content-type': 'application/json'},
data: {
created_at: '',
id: '',
is_owner: false,
name: '',
permissions: [],
updated_at: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/me/roles/:role_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"created_at":"","id":"","is_owner":false,"name":"","permissions":[],"updated_at":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"created_at": @"",
@"id": @"",
@"is_owner": @NO,
@"name": @"",
@"permissions": @[ ],
@"updated_at": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/me/roles/:role_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/me/roles/:role_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/me/roles/:role_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'created_at' => '',
'id' => '',
'is_owner' => null,
'name' => '',
'permissions' => [
],
'updated_at' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v1/me/roles/:role_id', [
'body' => '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/me/roles/:role_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'created_at' => '',
'id' => '',
'is_owner' => null,
'name' => '',
'permissions' => [
],
'updated_at' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'created_at' => '',
'id' => '',
'is_owner' => null,
'name' => '',
'permissions' => [
],
'updated_at' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/me/roles/:role_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/me/roles/:role_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/me/roles/:role_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v1/me/roles/:role_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/me/roles/:role_id"
payload = {
"created_at": "",
"id": "",
"is_owner": False,
"name": "",
"permissions": [],
"updated_at": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/me/roles/:role_id"
payload <- "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/me/roles/:role_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v1/me/roles/:role_id') do |req|
req.body = "{\n \"created_at\": \"\",\n \"id\": \"\",\n \"is_owner\": false,\n \"name\": \"\",\n \"permissions\": [],\n \"updated_at\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/me/roles/:role_id";
let payload = json!({
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": (),
"updated_at": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v1/me/roles/:role_id \
--header 'content-type: application/json' \
--data '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}'
echo '{
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
}' | \
http PUT {{baseUrl}}/v1/me/roles/:role_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "created_at": "",\n "id": "",\n "is_owner": false,\n "name": "",\n "permissions": [],\n "updated_at": ""\n}' \
--output-document \
- {{baseUrl}}/v1/me/roles/:role_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"created_at": "",
"id": "",
"is_owner": false,
"name": "",
"permissions": [],
"updated_at": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/me/roles/:role_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
CreateRefund
{{baseUrl}}/v1/:location_id/refunds
QUERY PARAMS
location_id
BODY json
{
"payment_id": "",
"reason": "",
"refunded_money": {
"amount": 0,
"currency_code": ""
},
"request_idempotence_key": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/refunds");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:location_id/refunds" {:content-type :json
:form-params {:payment_id ""
:reason ""
:refunded_money {:amount 0
:currency_code ""}
:request_idempotence_key ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/v1/:location_id/refunds"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/refunds"),
Content = new StringContent("{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/refunds");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/refunds"
payload := strings.NewReader("{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/:location_id/refunds HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 153
{
"payment_id": "",
"reason": "",
"refunded_money": {
"amount": 0,
"currency_code": ""
},
"request_idempotence_key": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:location_id/refunds")
.setHeader("content-type", "application/json")
.setBody("{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/refunds"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/refunds")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:location_id/refunds")
.header("content-type", "application/json")
.body("{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
payment_id: '',
reason: '',
refunded_money: {
amount: 0,
currency_code: ''
},
request_idempotence_key: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:location_id/refunds');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:location_id/refunds',
headers: {'content-type': 'application/json'},
data: {
payment_id: '',
reason: '',
refunded_money: {amount: 0, currency_code: ''},
request_idempotence_key: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/refunds';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"payment_id":"","reason":"","refunded_money":{"amount":0,"currency_code":""},"request_idempotence_key":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/refunds',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "payment_id": "",\n "reason": "",\n "refunded_money": {\n "amount": 0,\n "currency_code": ""\n },\n "request_idempotence_key": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/refunds")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/refunds',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
payment_id: '',
reason: '',
refunded_money: {amount: 0, currency_code: ''},
request_idempotence_key: '',
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:location_id/refunds',
headers: {'content-type': 'application/json'},
body: {
payment_id: '',
reason: '',
refunded_money: {amount: 0, currency_code: ''},
request_idempotence_key: '',
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/:location_id/refunds');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
payment_id: '',
reason: '',
refunded_money: {
amount: 0,
currency_code: ''
},
request_idempotence_key: '',
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:location_id/refunds',
headers: {'content-type': 'application/json'},
data: {
payment_id: '',
reason: '',
refunded_money: {amount: 0, currency_code: ''},
request_idempotence_key: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/refunds';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"payment_id":"","reason":"","refunded_money":{"amount":0,"currency_code":""},"request_idempotence_key":"","type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"payment_id": @"",
@"reason": @"",
@"refunded_money": @{ @"amount": @0, @"currency_code": @"" },
@"request_idempotence_key": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/refunds"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/refunds" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/refunds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payment_id' => '',
'reason' => '',
'refunded_money' => [
'amount' => 0,
'currency_code' => ''
],
'request_idempotence_key' => '',
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:location_id/refunds', [
'body' => '{
"payment_id": "",
"reason": "",
"refunded_money": {
"amount": 0,
"currency_code": ""
},
"request_idempotence_key": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/refunds');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'payment_id' => '',
'reason' => '',
'refunded_money' => [
'amount' => 0,
'currency_code' => ''
],
'request_idempotence_key' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'payment_id' => '',
'reason' => '',
'refunded_money' => [
'amount' => 0,
'currency_code' => ''
],
'request_idempotence_key' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:location_id/refunds');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/refunds' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"payment_id": "",
"reason": "",
"refunded_money": {
"amount": 0,
"currency_code": ""
},
"request_idempotence_key": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/refunds' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"payment_id": "",
"reason": "",
"refunded_money": {
"amount": 0,
"currency_code": ""
},
"request_idempotence_key": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v1/:location_id/refunds", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/refunds"
payload = {
"payment_id": "",
"reason": "",
"refunded_money": {
"amount": 0,
"currency_code": ""
},
"request_idempotence_key": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/refunds"
payload <- "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/:location_id/refunds') do |req|
req.body = "{\n \"payment_id\": \"\",\n \"reason\": \"\",\n \"refunded_money\": {\n \"amount\": 0,\n \"currency_code\": \"\"\n },\n \"request_idempotence_key\": \"\",\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/refunds";
let payload = json!({
"payment_id": "",
"reason": "",
"refunded_money": json!({
"amount": 0,
"currency_code": ""
}),
"request_idempotence_key": "",
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/:location_id/refunds \
--header 'content-type: application/json' \
--data '{
"payment_id": "",
"reason": "",
"refunded_money": {
"amount": 0,
"currency_code": ""
},
"request_idempotence_key": "",
"type": ""
}'
echo '{
"payment_id": "",
"reason": "",
"refunded_money": {
"amount": 0,
"currency_code": ""
},
"request_idempotence_key": "",
"type": ""
}' | \
http POST {{baseUrl}}/v1/:location_id/refunds \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "payment_id": "",\n "reason": "",\n "refunded_money": {\n "amount": 0,\n "currency_code": ""\n },\n "request_idempotence_key": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/v1/:location_id/refunds
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"payment_id": "",
"reason": "",
"refunded_money": [
"amount": 0,
"currency_code": ""
],
"request_idempotence_key": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/refunds")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ListOrders
{{baseUrl}}/v1/:location_id/orders
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/orders");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:location_id/orders")
require "http/client"
url = "{{baseUrl}}/v1/:location_id/orders"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/orders"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/orders");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/orders"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:location_id/orders HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:location_id/orders")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/orders"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/orders")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:location_id/orders")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:location_id/orders');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/orders'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/orders';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/orders',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/orders")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/orders',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/orders'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:location_id/orders');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/orders'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/orders';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/orders"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/orders" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:location_id/orders');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/orders');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:location_id/orders');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/orders' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/orders' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:location_id/orders")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/orders"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/orders"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:location_id/orders') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/orders";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/:location_id/orders
http GET {{baseUrl}}/v1/:location_id/orders
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/:location_id/orders
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/orders")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ListPayments
{{baseUrl}}/v1/:location_id/payments
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/payments");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:location_id/payments")
require "http/client"
url = "{{baseUrl}}/v1/:location_id/payments"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/payments"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/payments");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/payments"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:location_id/payments HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:location_id/payments")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/payments"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/payments")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:location_id/payments")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:location_id/payments');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/payments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/payments';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/payments',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/payments")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/payments',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/payments'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:location_id/payments');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/payments'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/payments';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/payments"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/payments" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:location_id/payments');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/payments');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:location_id/payments');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/payments' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/payments' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:location_id/payments")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/payments"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/payments"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:location_id/payments') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/payments";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/:location_id/payments
http GET {{baseUrl}}/v1/:location_id/payments
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/:location_id/payments
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/payments")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ListRefunds
{{baseUrl}}/v1/:location_id/refunds
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/refunds");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:location_id/refunds")
require "http/client"
url = "{{baseUrl}}/v1/:location_id/refunds"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/refunds"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/refunds");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/refunds"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:location_id/refunds HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:location_id/refunds")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/refunds"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/refunds")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:location_id/refunds")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:location_id/refunds');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/refunds'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/refunds';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/refunds',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/refunds")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/refunds',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/refunds'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:location_id/refunds');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/refunds'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/refunds';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/refunds"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/refunds" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/refunds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:location_id/refunds');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/refunds');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:location_id/refunds');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/refunds' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/refunds' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:location_id/refunds")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/refunds"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/refunds"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:location_id/refunds') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/refunds";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/:location_id/refunds
http GET {{baseUrl}}/v1/:location_id/refunds
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/:location_id/refunds
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/refunds")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
ListSettlements
{{baseUrl}}/v1/:location_id/settlements
QUERY PARAMS
location_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/settlements");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:location_id/settlements")
require "http/client"
url = "{{baseUrl}}/v1/:location_id/settlements"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/settlements"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/settlements");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/settlements"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:location_id/settlements HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:location_id/settlements")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/settlements"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/settlements")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:location_id/settlements")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:location_id/settlements');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/settlements'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/settlements';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/settlements',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/settlements")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/settlements',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/settlements'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:location_id/settlements');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v1/:location_id/settlements'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/settlements';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/settlements"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/settlements" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/settlements",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:location_id/settlements');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/settlements');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:location_id/settlements');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/settlements' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/settlements' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:location_id/settlements")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/settlements"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/settlements"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/settlements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:location_id/settlements') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/settlements";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/:location_id/settlements
http GET {{baseUrl}}/v1/:location_id/settlements
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/:location_id/settlements
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/settlements")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
RetrieveOrder
{{baseUrl}}/v1/:location_id/orders/:order_id
QUERY PARAMS
location_id
order_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/orders/:order_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:location_id/orders/:order_id")
require "http/client"
url = "{{baseUrl}}/v1/:location_id/orders/:order_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/orders/:order_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/orders/:order_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/orders/:order_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:location_id/orders/:order_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:location_id/orders/:order_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/orders/:order_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/orders/:order_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:location_id/orders/:order_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:location_id/orders/:order_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/orders/:order_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/orders/:order_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/orders/:order_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/orders/:order_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/orders/:order_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/orders/:order_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:location_id/orders/:order_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/orders/:order_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/orders/:order_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/orders/:order_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/orders/:order_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/orders/:order_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:location_id/orders/:order_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/orders/:order_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:location_id/orders/:order_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/orders/:order_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/orders/:order_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:location_id/orders/:order_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/orders/:order_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/orders/:order_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/orders/:order_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:location_id/orders/:order_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/orders/:order_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/:location_id/orders/:order_id
http GET {{baseUrl}}/v1/:location_id/orders/:order_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/:location_id/orders/:order_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/orders/:order_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
RetrievePayment
{{baseUrl}}/v1/:location_id/payments/:payment_id
QUERY PARAMS
location_id
payment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/payments/:payment_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:location_id/payments/:payment_id")
require "http/client"
url = "{{baseUrl}}/v1/:location_id/payments/:payment_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/payments/:payment_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/payments/:payment_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/payments/:payment_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:location_id/payments/:payment_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:location_id/payments/:payment_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/payments/:payment_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/payments/:payment_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:location_id/payments/:payment_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:location_id/payments/:payment_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/payments/:payment_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/payments/:payment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/payments/:payment_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/payments/:payment_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/payments/:payment_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/payments/:payment_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:location_id/payments/:payment_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/payments/:payment_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/payments/:payment_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/payments/:payment_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/payments/:payment_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/payments/:payment_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:location_id/payments/:payment_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/payments/:payment_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:location_id/payments/:payment_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/payments/:payment_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/payments/:payment_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:location_id/payments/:payment_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/payments/:payment_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/payments/:payment_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/payments/:payment_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:location_id/payments/:payment_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/payments/:payment_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/:location_id/payments/:payment_id
http GET {{baseUrl}}/v1/:location_id/payments/:payment_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/:location_id/payments/:payment_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/payments/:payment_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
RetrieveSettlement
{{baseUrl}}/v1/:location_id/settlements/:settlement_id
QUERY PARAMS
location_id
settlement_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/settlements/:settlement_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v1/:location_id/settlements/:settlement_id")
require "http/client"
url = "{{baseUrl}}/v1/:location_id/settlements/:settlement_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/settlements/:settlement_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/settlements/:settlement_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/settlements/:settlement_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v1/:location_id/settlements/:settlement_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v1/:location_id/settlements/:settlement_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/settlements/:settlement_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/settlements/:settlement_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v1/:location_id/settlements/:settlement_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v1/:location_id/settlements/:settlement_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/settlements/:settlement_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/settlements/:settlement_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/settlements/:settlement_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/settlements/:settlement_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/settlements/:settlement_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/settlements/:settlement_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v1/:location_id/settlements/:settlement_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v1/:location_id/settlements/:settlement_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/settlements/:settlement_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/settlements/:settlement_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/settlements/:settlement_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/settlements/:settlement_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v1/:location_id/settlements/:settlement_id');
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/settlements/:settlement_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:location_id/settlements/:settlement_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/settlements/:settlement_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/settlements/:settlement_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v1/:location_id/settlements/:settlement_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/settlements/:settlement_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/settlements/:settlement_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/settlements/:settlement_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v1/:location_id/settlements/:settlement_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/settlements/:settlement_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v1/:location_id/settlements/:settlement_id
http GET {{baseUrl}}/v1/:location_id/settlements/:settlement_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v1/:location_id/settlements/:settlement_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/settlements/:settlement_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
UpdateOrder
{{baseUrl}}/v1/:location_id/orders/:order_id
QUERY PARAMS
location_id
order_id
BODY json
{
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:location_id/orders/:order_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/v1/:location_id/orders/:order_id" {:content-type :json
:form-params {:action ""
:canceled_note ""
:completed_note ""
:refunded_note ""
:shipped_tracking_number ""}})
require "http/client"
url = "{{baseUrl}}/v1/:location_id/orders/:order_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/v1/:location_id/orders/:order_id"),
Content = new StringContent("{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:location_id/orders/:order_id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:location_id/orders/:order_id"
payload := strings.NewReader("{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/v1/:location_id/orders/:order_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 121
{
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/v1/:location_id/orders/:order_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:location_id/orders/:order_id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:location_id/orders/:order_id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/v1/:location_id/orders/:order_id")
.header("content-type", "application/json")
.body("{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}")
.asString();
const data = JSON.stringify({
action: '',
canceled_note: '',
completed_note: '',
refunded_note: '',
shipped_tracking_number: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/v1/:location_id/orders/:order_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/:location_id/orders/:order_id',
headers: {'content-type': 'application/json'},
data: {
action: '',
canceled_note: '',
completed_note: '',
refunded_note: '',
shipped_tracking_number: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:location_id/orders/:order_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"action":"","canceled_note":"","completed_note":"","refunded_note":"","shipped_tracking_number":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:location_id/orders/:order_id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "action": "",\n "canceled_note": "",\n "completed_note": "",\n "refunded_note": "",\n "shipped_tracking_number": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:location_id/orders/:order_id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:location_id/orders/:order_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
action: '',
canceled_note: '',
completed_note: '',
refunded_note: '',
shipped_tracking_number: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/:location_id/orders/:order_id',
headers: {'content-type': 'application/json'},
body: {
action: '',
canceled_note: '',
completed_note: '',
refunded_note: '',
shipped_tracking_number: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/v1/:location_id/orders/:order_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
action: '',
canceled_note: '',
completed_note: '',
refunded_note: '',
shipped_tracking_number: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/v1/:location_id/orders/:order_id',
headers: {'content-type': 'application/json'},
data: {
action: '',
canceled_note: '',
completed_note: '',
refunded_note: '',
shipped_tracking_number: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:location_id/orders/:order_id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"action":"","canceled_note":"","completed_note":"","refunded_note":"","shipped_tracking_number":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"action": @"",
@"canceled_note": @"",
@"completed_note": @"",
@"refunded_note": @"",
@"shipped_tracking_number": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:location_id/orders/:order_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:location_id/orders/:order_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:location_id/orders/:order_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'action' => '',
'canceled_note' => '',
'completed_note' => '',
'refunded_note' => '',
'shipped_tracking_number' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/v1/:location_id/orders/:order_id', [
'body' => '{
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:location_id/orders/:order_id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'action' => '',
'canceled_note' => '',
'completed_note' => '',
'refunded_note' => '',
'shipped_tracking_number' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'action' => '',
'canceled_note' => '',
'completed_note' => '',
'refunded_note' => '',
'shipped_tracking_number' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:location_id/orders/:order_id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:location_id/orders/:order_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:location_id/orders/:order_id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/v1/:location_id/orders/:order_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:location_id/orders/:order_id"
payload = {
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:location_id/orders/:order_id"
payload <- "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:location_id/orders/:order_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/v1/:location_id/orders/:order_id') do |req|
req.body = "{\n \"action\": \"\",\n \"canceled_note\": \"\",\n \"completed_note\": \"\",\n \"refunded_note\": \"\",\n \"shipped_tracking_number\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:location_id/orders/:order_id";
let payload = json!({
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/v1/:location_id/orders/:order_id \
--header 'content-type: application/json' \
--data '{
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
}'
echo '{
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
}' | \
http PUT {{baseUrl}}/v1/:location_id/orders/:order_id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "action": "",\n "canceled_note": "",\n "completed_note": "",\n "refunded_note": "",\n "shipped_tracking_number": ""\n}' \
--output-document \
- {{baseUrl}}/v1/:location_id/orders/:order_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"action": "",
"canceled_note": "",
"completed_note": "",
"refunded_note": "",
"shipped_tracking_number": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:location_id/orders/:order_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()